스프링 데이터 저장소 구현을 다른 폴더로 옮길 수 있습니까 (원본 인터페이스의 동일 또는 하위 폴더가 아닌 경우)? 같은 폴더에 인터페이스와 구현이 있으면 잘 작동합니다. 예를 들어 com.app.domain.repo
에서 com.app.infrastr.repo
으로 이동하면 Invocation of init method failed; nested exception is org.springframework.data.mapping.PropertyReferenceException: No property methodName found for type RepoInterfaceName
이됩니다.스프링 저장소를 다른 폴더로 이동
UPDATE
import com.app.domain.repo
public interface ARepo extends ElasticsearchRepository<A, String>, CustomizedARepo {
}
public interface CustomizedARepo {
List<A> makeSearch(int x);
}
import com.app.infrastr.repo
public class CustomizedARepoImpl implements CustomizedARepo {
private ElasticsearchTemplate elasticsearchTemplate;
public CustomizedARepoImpl(ElasticsearchTemplate elasticsearchTemplate) {
this.elasticsearchTemplate = elasticsearchTemplate;
}
@Override
public List<A> makeSearch(int x){ return null; }
}
및 구성 클래스는
@Configuration
@EnableElasticsearchRepositories(basePackages = {"com.app.domain.repo", "com.app.infrastr.repo"})
public class Config{}
오류입니다 :
Invocation of init method failed; nested exception is org.springframework.data.mapping.PropertyReferenceException: No property makeSearch found for type ARepo
나는 모든 확인을 작동 CustomizedARepoImpl
com.app.domain.repo
로 이동합니다.
사람들의 대답을 돕기 위해 여기에 관련 코드를 제공하십시오. 여기에는 많은 가능성이 있습니다. 내 생각 엔 특정 패키지를 가리키는 사용자 정의 entityManagerFactory() bean이 있다는 것입니다. – Brian
질문이 업데이트되었습니다. – bojanv55
추가 한 내용에 따라 JPA 및 ES 리포지토리를 혼합 할 것인지 궁금합니다. 이 답변이 도움이됩니까? https://stackoverflow.com/a/32879779/4614870 – Brian