r/SpringBoot • u/HappyPurchase72 • Sep 29 '24
Package structure
What do you think about this package structure? What packages or layers would you add or remove if you work with microservices architecture?
43
Upvotes
r/SpringBoot • u/HappyPurchase72 • Sep 29 '24
What do you think about this package structure? What packages or layers would you add or remove if you work with microservices architecture?
4
u/RupertMaddenAbbott Sep 30 '24 edited Sep 30 '24
For me, these packages are the wrong way around.
If I have close coupling between a controller, a service and some persistence classes, then I think they should all be close together in the structure e.g. in the same package.
Another way to look at it is to ask "Do the classes in the repository package need to access each other?" If the answer is no then my question would be "Why are they placed close together?"
Equally, I would rather have any person configuration and person configuration properties within a person package rather than lumped together into classes that handle config and properties for all of the modules within an application.