Spring Boot Code Structure

It is very important to structure your code in a way that is maintainable and easy to work with. A lot of times developers drag their feet to work on a project that is unorganized and hard to follow. Your team members will appreciate the fact that you took the time to organize your code to a certain structure. There are mainly two ways to organize your code. One is by component or layer and the other is by entities.

Component or Layer Driven Layout

Entity Driven Layout

Layout and structure is a matter of preference. When you choose a layout in most cases you will have to stick to that layout and not change. You can mix and match but I don’t recommend this approach as it would make the project very hard to follow.

I usually go with the entity driven layout because it is easier for me to follow my project that way. I can find what I am looking for 99% of the time just by looking at the packages without having to drill down to the classes. Not only that I can really use encapusulation to make that services only access other services on the service layer not on the DAO layer.




Subscribe To Our Newsletter
You will receive our latest post and tutorial.
Thank you for subscribing!

required
required


Leave a Reply

Your email address will not be published. Required fields are marked *