简体   繁体   中英

External repository and repository implementation

The repository that is being used in the Spring Boot application (this is located in the main module):

@Repository
public interface PersonRepository extends MongoRepository<Person, String>, AzureRepository<Person, String> {

}

The repository and implementation of the repository (these are located in a different maven module):

public interface AzureRepository<T, ID> {

    boolean customUpdate(T entity);

}

public class AzureRepositoryImpl<T, ID> implements AzureRepository<T, ID> {
  ...
}

This configuration produces the following error:

Caused by: org.springframework.data.mapping.PropertyReferenceException: No property customUpdate found for type Person!

The custom repository and its implementation works fine when everything is in the same maven module. But when the custom repository and its implementation are placed in the utility maven module then the error from above gets thrown.

我应该使用@EnableMongoRepositories来指定外部存储库的基本包,而不是使用@EnableJpaRepositories

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM