Spring Data Solr-映射自定义存储库时出现异常
我正在尝试将分面搜索与自定义存储库结合使用,如下所示: 存储库:Spring Data Solr-映射自定义存储库时出现异常,spring,solr,spring-data,facets,spring-data-solr,Spring,Solr,Spring Data,Facets,Spring Data Solr,我正在尝试将分面搜索与自定义存储库结合使用,如下所示: 存储库: public interface POISearchRepository extends CustomSolrRepository, SolrCrudRepository<POISearch, String> 公共接口存储库扩展了CustomSolrRepository,SolrCrudRepository 自定义接口: public interface CustomSolrRepository {
public interface POISearchRepository extends CustomSolrRepository, SolrCrudRepository<POISearch, String>
公共接口存储库扩展了CustomSolrRepository,SolrCrudRepository
自定义接口:
public interface CustomSolrRepository {
FacetPage<POISearch> facetSearch(String location, String categories, String duration, Pageable page) throws Exception;
}
公共接口CustomSolrRepository{
FacePage FaceSearch(字符串位置、字符串类别、字符串持续时间、可分页页面)引发异常;
}
自定义impl:
@Repository
public class POISearchImpl implements CustomSolrRepository {
@Resource
private SolrTemplate solrTemplate;
@Override
public FacetPage<POISearch> facetSearch(String location, String categories, String duration, Pageable page) throws Exception {
......
}
@存储库
公共类POISearchImpl实现CustomSolrRepository{
@资源
私有SolrTemplate SolrTemplate;
@凌驾
公共FacePage FaceSearch(字符串位置、字符串类别、字符串持续时间、可分页页面)引发异常{
......
}
不幸的是,我一直遇到以下异常:
原因:
org.springframework.data.mapping.PropertyReferenceException:否
在找到com.example.domain.POISearch类型的属性方面
org.springframework.data.mapping.PropertyPath.(PropertyPath.java:75)
在
org.springframework.data.mapping.PropertyPath.create(PropertyPath.java:327)
在
org.springframework.data.mapping.PropertyPath.create(PropertyPath.java:353)
在
org.springframework.data.mapping.PropertyPath.create(PropertyPath.java:307)
在
org.springframework.data.mapping.PropertyPath.from(PropertyPath.java:271)
在
org.springframework.data.mapping.PropertyPath.from(PropertyPath.java:245)
在
org.springframework.data.repository.query.parser.Part.(Part.java:72)
在
org.springframework.data.repository.query.parser.PartTree$OrPart.(PartTree.java:180)
在
org.springframework.data.repository.query.parser.PartTree$Predicate.buildTree(PartTree.java:260)
在
org.springframework.data.repository.query.parser.PartTree$谓词(PartTree.java:240)
在
org.springframework.data.repository.query.parser.PartTree.(PartTree.java:68)
在
org.springframework.data.solr.repository.query.PartTreeSolrQuery.(PartTreeSolrQuery.java:36)
在
org.springframework.data.solr.repository.support.SolrRepositoryFactory$SolrQueryLookupStrategy.resolveQuery(SolrRepositoryFactory.java:101)
在
org.springframework.data.repository.core.support.RepositoryFactorySupport$QueryExecutorMethodInterceptor。(RepositoryFactorySupport.java:279)
在
org.springframework.data.repository.core.support.RepositoryFactorySupport.getRepository(RepositoryFactorySupport.java:147)
在
org.springframework.data.repository.core.support.RepositoryFactoryBeanSupport.getObject(RepositoryFactoryBeanSupport.java:153)
在
org.springframework.data.repository.core.support.RepositoryFactoryBeanSupport.getObject(RepositoryFactoryBeanSupport.java:43)
在
org.springframework.beans.factory.support.FactoryBeanRegistrySupport.doGetObjectFromFactoryBean(FactoryBeanRegistrySupport.java:142)
…还有57个
似乎存储库试图解析自定义方法,这导致了异常(更改方法名称表明)问题在于我的存储库intrefaces的命名。修复: 存储库:POISearchRepository 自定义接口:POISearchRepositoryCustom 客户实施:POISearchRepositoryImpl 我最初的命名不符合Spring数据规范