Best Spring boot project structure with controller, service, entity and repository

47 Views Asked by At

Working on new project, it's a spring boot microservice application and I have a each controller, service and repository for each module like common, online and offline so I have created project structure as below,

1)

com.netbank.abc
               configuration
               entity
               constants
               utils
               common
                     controller
                     service
                     repository
               online
                     controller
                     service
                     repository
  1. This is another approach kept entity also inside corresponding packages,
com.netbank.abc
               configuration
               constants
               utils
               common
                     controller
                     service
                     repository
                     entity
               online
                     controller
                     service
                     repository
                     entity
  1. Created each layer with each module packages like below,
com.netbank.abc
               configuration
               entity
               constants
               utils
               controller
                         common
                         online
               service
                         common
                         online
               repository
                         common
                         online

Let me know which one need to go for project structure as I feel the first one looks fine as we have some common layer and with corresponding controller, service and repository folder.

0

There are 0 best solutions below