に私は次のようにプロジェクト構造がある春ブーツでマルチモジュールプロジェクトを開発しています:親プロジェクトのpom.xml
ファイルがあるアクセス親のapplication.properties春ブーツ
com.app.parent <- parent pom with version numbers and common dependencies (POM)
com.app.core <- repository and service layer, models, DTOs (JAR)
com.app.rest <- rest API (WAR)
com.app.soap <- soap API (WAR)
を:
<artifactId>app-parent</artifactId>
<packaging>pom</packaging>
<name>app-parent</name>
<parent>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-parent</artifactId>
<version>1.5.3.RELEASE</version>
<relativePath/>
</parent>
<dependencies>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter</artifactId>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-test</artifactId>
<scope>test</scope>
</dependency>
</dependencies>
<build>
<plugins>
<plugin>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-maven-plugin</artifactId>
</plugin>
</plugins>
</build>
コアプロジェクトのpom.xml
ファイルは次のとおりです。
<artifactId>app-core</artifactId>
<packaging>jar</packaging>
<name>app-core</name>
<parent>
<groupId>com.app</groupId>
<artifactId>app-parent</artifactId>
<version>0.0.1-SNAPSHOT</version>
<relativePath>../app-parent/pom.xml</relativePath>
</parent>
<dependencies>
<dependency>
<groupId>mysql</groupId>
<artifactId>mysql-connector-java</artifactId>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-data-jpa</artifactId>
</dependency>
</dependencies>
残りプロジェクトのpom.xml
がある:
<artifactId>app-rest</artifactId>
<packaging>war</packaging>
<name>app-rest</name>
<parent>
<groupId>com.app</groupId>
<artifactId>app-parent</artifactId>
<version>0.0.1-SNAPSHOT</version>
<relativePath>../app-parent/pom.xml</relativePath>
</parent>
<dependencies>
<dependency>
<groupId>com.app</groupId>
<artifactId>app-core</artifactId>
<version>0.0.1-SNAPSHOT</version>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-web</artifactId>
</dependency>
</dependencies>
アプリコアプロジェクトのエントリポイントは次のとおり
@SpringBootApplication
public class CoreApplication {
public static void main(String[] args) {
SpringApplication.run(CoreApplication.class, args);
}
}
APP-残りのエントリポイントプロジェクトはまったく同じように見えます。
core/src/main/resources/
の中にapplication.properties
というファイルが作成されています。このファイルにはデータベース設定などが含まれており、アプリコアプロジェクトをコンパイル/テストすることはできます。しかし、私はapplication.properties
ファイル
の欠如に関連するエラーは、データベース・タイプNONE用の組み込みデータベースドライバのクラスを決定することはできません取得するアプリ-残りのプロジェクトを実行したり、テストしようとします。組み込みデータベースが必要な場合は、サポートされているデータベースをクラスパスに入れてください。
子プロジェクトに親のapplication.properties
ファイルを読み込ませるにはどうすればよいですか?親ファイルへのシンボリックリンクを作成する必要がありますか、または明示的に親のプロパティファイルを@PropertySource
経由でロードしますか?このシナリオで他の人は何をしますか?