I am developing a spring boot project consisting of multiple independent modules used by the main project. As I am new to this, I need guidance on how to segregate large project into maven modules. I have few ideas which I would like to get your opinion on,
- Modules by feature (and only by feature): Each feature is segregated into its own modules. Thus, the modules would have their own Entities, Repositories, Services. Only services which would be consumed by other modules.
Parent Project
|- Feature 1 (owns dtos, repo, entities)
|- Feature 2 (owns dtos, repo, entities)
|- ...
|- Main project (depends on Feature 1,2, ...)
- Modules by common concerns and subsequently by feature
Parent Project
|- Entities
|- Repositories (depends on Entities)
|- Dtos (depends on Entities)
|- Feature 1 (depends on dtos, repo)
|- Feature 2 (depends on dtos, repo)
|- Main project (depends on Feature Entities, Repositories, Dtos,1,2, ...)
I would like to know the pros and cons of either of the approaches. Any new approach is also welcome.