Spring boot app in another project from controller class

I want to know if I can keep my Spring boot class in Project A and my controller and services in Project B and invoke the end-points from Project A? The reason to do this is because I want to give Project A (which has dependency of Project B) an option to extend my controller and services to override any method.

1 answer

  • answered 2018-10-09 16:40 Adina

    Yes, it is a common practice to have your starter in a project and the libraries in another (spring projects are a good example for it).

    1. it is better to have them separated in 2 repositories :faster build, version management, separation of responsibility between team members etc.

    2. Build the project with the libraries (A)

    3. Project with the starter (B) will have a dependency to project A

    4. In general, it is recommended to have a configuration in project A with @ComponentScan and project B should import the configuration.

    If the beans are scanned from project A, you will have access to all endpoints and services.