リポジトリの個別のモジュールをスキャンするようにSping Dataを取得することは可能ですか? ある Maven モジュールでリポジトリを作成し、依存関係のある別のモジュールからアクセスしたいと考えています。ただし、複数のモジュール/jarファイルをスキャンするように指示する構成を理解できません。
ログには、必要なリポジトリが「test-model」にある「core-engine」のスキャンに関する複数の参照が表示されます。
DEBUG main - core.io.support.PathMatchingResourcePatternResolver - Searching directory
[<path>\engine\core-engine\target\test-classes\] for files matching pattern
[<path>/engine/core-engine/target/test-classes/**/model/repository/**/*.class]
プロジェクトには多数のモジュールがありますが、この場合に影響を与えるのは「コア エンジン」と「テスト モデル」の 2 つだけです。「test-model」には、リポジトリ定義、エンティティ、およびリポジトリ インターフェイスなど、すべての構成が含まれます。「core-engine」は「test-model」に依存しています。SpringRunner を使用してテストを実行していますが、「test-model」自体で ContextConfiguration を参照するか、リポジトリ構成 xml を別の「core-engine」構成にインポートして間接的に参照しようとしましたが、役に立ちませんでした。リポジトリを使用する「test-model」モジュール内でテストを実行しています。私の問題は、「core-engine」からこれらのリポジトリにアクセスすることです。
--> test-model (maven module)
---->src/main/java
------>com.test.model.domain (various simple Entities)
------>com.test.model.repository (the repository interfaces)
---->src/main/resources
------>META-INF/datapump/dao-jpa-repository.xml
---->src/test/java
------>com.test.model.domin (various simple CRUD tests using the repositories)
---->src/test/resources
------>META-INF/test-context.xml (defines the Application context and imports dao-jpa-respoitory)
dao-jpa-repository.xml には、test-model モジュール内で検出され、テスト可能な行が含まれています
core-engine は test-model に依存しています。
--> core-engine (maven module)
---->src/main/java
------>com.test.model.inject (classes which attempt to use the repositories defined in test-model)
---->src/test/java
------>com.test.model.inject (tests for the above classes)
---->src/test/resources
------>META-INF/test-context.xml (defines the Application context and also imports dao-jpa-respository from the test-model)
上記から、リポジトリを使用してテストモデルからエンティティを永続化しようとするコアエンジンのテストがあります。ただし、リポジトリがコンテキストにないように見えるため、(自動配線または手動で検索して) リポジトリにアクセスできません。
誰かが助けてくれれば、私はそれを感謝します。乾杯