Spring 弹簧靴2+;实体/jpa作为子模块
带maven多模块项目的spring boot 2 我们如何创建JPA/entity作为单独的模块,并将依赖项添加到主项目中 我已经阅读了许多链接,但仍然没有找到解决方案,请帮助 我想创建一个项目结构如下 实体项目-所有实体和JPA相关配置[数据库和所有配置] 主服务[包括实体]和实体项目的存储库将在这里Spring 弹簧靴2+;实体/jpa作为子模块,spring,spring-boot,maven-3,multi-module,Spring,Spring Boot,Maven 3,Multi Module,带maven多模块项目的spring boot 2 我们如何创建JPA/entity作为单独的模块,并将依赖项添加到主项目中 我已经阅读了许多链接,但仍然没有找到解决方案,请帮助 我想创建一个项目结构如下 实体项目-所有实体和JPA相关配置[数据库和所有配置] 主服务[包括实体]和实体项目的存储库将在这里 请帮助……下面是我的项目结构 汇款rs是主要的项目模块,包括我们在pom.xml文件中定义的所有子模块,如下所示: <groupId>org.soyphea.remittance&
请帮助……下面是我的项目结构 汇款rs是主要的项目模块,包括我们在pom.xml文件中定义的所有子模块,如下所示:
<groupId>org.soyphea.remittance</groupId>
<artifactId>remittance-rs</artifactId>
<version>0.0.1-SNAPSHOT</version>
<modules>
<module>service</module>
<module>domain</module>
<module>remmittant-restapi</module>
</modules>
org.soyphea.com
所以我有3个模块,包括服务用于我们的逻辑,域用于我们的DAO和域,最后一个restapi用于我们公开的rest端点
所以所有子模块都需要包含父工件和组id,如下所示
<parent>
<groupId>org.soyphea.remittance</groupId>
<artifactId>remittance-rs</artifactId>
<version>0.0.1-SNAPSHOT</version>
</parent>
org.soyphea.com
感谢您的回复,但无论我在哪里使用域模块,我都必须正确设置数据库配置??您可以使用主模块(如web或rest api模块)设置配置。因为我们假设域模块在DAO上是相关的,实体在那个里并没有配置。我们的配置应该有一个位置。但我有多个主项目将使用实体/dao项目。。。那么我们如何在entity/dao模块中配置数据库配置。。。你能告诉我你的主要项目是什么吗?示例:您应该拥有的支付api(dao的域模块、逻辑的服务模块以及控制器的web mvc或rest端点)。您的配置应该在rest端点模块中,我称之为主模块。我们使用微服务,我们有多个微服务,它们使用相同的实体/dao。。。。谢谢你的帮助
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
<parent>
<groupId>org.soyphea.remittance</groupId>
<artifactId>remittance-rs</artifactId>
<version>0.0.1-SNAPSHOT</version>
</parent>
<artifactId>org.soyphea.domain</artifactId>
<dependencies>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-data-jpa</artifactId>
</dependency>
<!-- https://mvnrepository.com/artifact/com.fasterxml.jackson.core/jackson-annotations -->
<dependency>
<groupId>com.fasterxml.jackson.core</groupId>
<artifactId>jackson-annotations</artifactId>
</dependency>
</dependencies>
</project>