[英]Spring boot (and web) multi module project
我正在尝试创建一个多模块 spring 引导项目(Struts2/Ibatis 项目的重写),我希望将其布局如下:
-- Parent project. //contains <properties> that should be shared through the child modules
|- model //Contains ONLY Hibernate entities
|- dataaccess //uses 'model' but has dataManagers and dataRepositories with Spring @Autowired beans
|- webapp //uses 'dataaccess' module and uses Spring @Controller for processing requests
|- scheduled //Spring boot console app that runs once a day, uses 'dataaccess' module for DB read writes
我如何设置每个 pom,以便:
1 - <properties> only need to be set in one pom but are accessible to the other modules
2 - Where should I use <parent> <artifactId>spring-boot-starter-parent or should I somehow access the spring boot modules in some other way?
3 - How can I optimise the pom heirarchy so that only the necessary libraries are exposed to the relevant module (i.e. in the 'model' module there will be no need to have access to spring-boot-starter-web etc.)
谢谢你。
在这种情况下,您可以有 5 个 pom.xml 文件。 每个模块(包括父模块)都有自己的 pom.xml。
对于 spring-boot 应用程序,我们有类似的项目结构。 我们在父 pom 中有 spring-boot-starter-parent ,在需要的各个模块中有其他库,如数据访问等。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.