Thoughts on My CQRS Implementation with Spring Modulith?

0
1
Asked By CreativeScribbler92 On

Hey everyone! I just released an article on my blog about how to implement CQRS using some cool features offered by Spring Modulith. I'd love to hear your thoughts on it! Here's the link to the article: [https://gaetanopiazzolla.github.io/java/design-patterns/springboot/2025/03/17/cqrs.html](https://gaetanopiazzolla.github.io/java/design-patterns/springboot/2025/03/17/cqrs.html). Thanks in advance!

1 Answer

Answered By TechGuru_33 On

Awesome article! I really liked how you emphasized separating the models for state manipulation from those designed for reading. That’s often overlooked but super important. The example of using Spring Modulith's `(At)ApplicationModuleListener` to update models in an eventually consistent manner is really well done. Just a couple of thoughts from a design perspective:

1. Be aware that ‘command’ and ‘query’ should not be treated as modules in the Spring Modulith framework; they’re more about how to technically handle your logic within a module.

2. It’s common to see developers use architectural patterns and stereotypes to group similar pieces of code, but watch out! This can lead to low-cohesion structures.

3. Spring modules are ideally set up to expose necessary APIs for other modules, so try to keep implementation details from cluttering the main package. If you're looking for ways to keep code well-organized, check out jMolecules; it has some cool annotations for that!

GaetanoScribe -

Thanks for the feedback! I’m really pleased to hear from you. I’m definitely using Modulith in my projects, and it’s working wonderfully. i appreciate your advice, especially on module structure. Can you elaborate on why low cohesion is detrimental?

Related Questions

LEAVE A REPLY

Please enter your comment!
Please enter your name here

This site uses Akismet to reduce spam. Learn how your comment data is processed.