Java 外部存储库和存储库实现
正在Spring引导应用程序中使用的存储库(位于主模块中):Java 外部存储库和存储库实现,java,spring-boot,jpa,Java,Spring Boot,Jpa,正在Spring引导应用程序中使用的存储库(位于主模块中): 当所有内容都在同一个maven模块中时,自定义存储库及其实现工作正常。但是,当自定义存储库及其实现放在utility maven模块中时,就会抛出上面的错误。而不是使用@EnableJpaRepositories我应该使用@EnableMongoRepositories来指定外部存储库的基本包。可能是因为spring没有扫描这些存储库因为它们在不同的包装中。检查@springbootplication@Harshit的scanBase
当所有内容都在同一个maven模块中时,自定义存储库及其实现工作正常。但是,当自定义存储库及其实现放在utility maven模块中时,就会抛出上面的错误。而不是使用
@EnableJpaRepositories
我应该使用@EnableMongoRepositories
来指定外部存储库的基本包。可能是因为spring没有扫描这些存储库因为它们在不同的包装中。检查@springbootplication
@Harshit的scanBasePackages值,它被spring作为bean获取,但它没有将impl bean链接为存储库
@Repository
public interface PersonRepository extends MongoRepository<Person, String>, AzureRepository<Person, String> {
}
public interface AzureRepository<T, ID> {
boolean customUpdate(T entity);
}
public class AzureRepositoryImpl<T, ID> implements AzureRepository<T, ID> {
...
}
Caused by: org.springframework.data.mapping.PropertyReferenceException: No property customUpdate found for type Person!