Setting up the project

Since we are still using Spring boot, the build file does not need any modification; we will use it as we will use the same file as in the last chapter. The package structure, however, is a bit different. This time, we do something more complicated than getting a request and responding to whatever the backend services deliver to us. Now, we have to implement complex business logic that, as we will see, needs many classes. When we have more than 10 classes, give or take, in a certain package, it is time to think about putting them into separate packages. The classes that are related to each other and have a similar functionality should be put into one package. This way, we will have a package for the following:

  • The controllers (though we have only one in this example, but usually there are more)
  • Data storing beans that have no more functionality than storing data, thus, fields, setters, and getters
  • Checkers that will help us check power cords when a desk-side lamp is ordered
  • Services that perform different services for the controller
  • The main package for our program that contains the Application class, SpringConfiguration, and some interfaces
..................Content has been hidden....................

You can't read the all page of ebook, please click here login for view all page.
Reset
3.149.29.71