I'd done a lot of Boot projects before. But never tried multi-module structure.
Here is the my sample structure
Parent project: com.github.o.parent
Just declares org.springframework.boot-spring-boot-autoconfigure
Common project: com.github.o.common
Holds entities, repositories and repository related service classes. Only have a configuration class for HikariCP data source. Question: Which annotations (especially JPA related) right for this configuration class?
Rest project: com.github.o.rest
Depends to JPA project. Needs to use common project service classes. Also have a Application class with SpringBootApplication. Question: Same, which annotations needed for scanning common project services and repositories.
I'd tried different annotations / configurations but i can't inject a repository from common project.
Thanks.
Well, ok, there are two things worth addressing here:
you gain nothing by keeping entities and services in a separate maven module.
Imagine you have the following services,
orders,customers, etc.ordersOrderService.java)}customersCustomerService.java)}Here, you're dividing things logically. Create a new Spring Boot application for each one, starting from start.spring.io. (Choose
Web, andJPA(or MongoDB or JOOQ or any of the far more powerful alternatives besides JPA).communication between services happens in terms of REST or messaging.