r/SpringBoot • • Sep 29 '24

Package structure

Post image

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

43 comments sorted by

View all comments

17

u/Holothuroid Sep 30 '24 edited Sep 30 '24

You seem to sort by some technical criteria. Having done so in the past, I now recommend sorting by feature. Everything Person goes into one package. Possibly some subpackages, if it's more than seven files.

2

u/Cr4zyPi3t Sep 30 '24

That’s what I recently started doing. Imo it’s more convenient since you don’t have to open 4 packages when working on one feature. Since usually I work on one or two features at a time I now only need to open a maximum of two packages. Also it’s really easy to see the functionalities of an application by looking at the top level packages.

1

u/HappyPurchase72 Sep 30 '24

Thanks for your comment, I've seen the structure you mention in some client-side applications, I'll keep it in mind.