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?
13
u/g00glen00b Sep 29 '24
I think it's far too detailed. Even if code becomes more complex, it's still going to be a microservice, so I can't imagine the need for this structure. I would remove the deepst package level, so:
configuration.app + configuration.security = configuration
persistence.entity + persistence.repository = persistence
presentation.advice + presentation.controller + presentation.dto = presentation
service.http + service.implementation + service.interfaces = service
util.mapper = util
Also, I'd argue that your exceptions are part of your presentation layer. A DTO is used in the presentation layer when something went successful, and an exception if something didn't go successful.