Posts

Showing posts from October, 2018

Spring is like onion - about layers

Image
Spring has a lot of standards and share knowledge about good practice for using it. One of these is chop your application for layers. Three layers of your application The good practices tell us, we should create three or more layers of our enterprise application. Those layers are controllers, services and repositories. In my opinion, this is very good practices, because we are separate three things communication with client, business logic and communication with other systems. I think this is a reason why spring promote this solution. If you want a proof that spring prefer a layers take a look at the specific annotation for the components we have three predefined: @Service, @Controller and @Repository. This is the same like @Component, but we have a marker for that. This is ok, but... This is very problematic, when we use this solution without thinking. We can put all services in one package. A lot of tutorials do that. If you do that you will have a problem with relations between