【发布时间】:2013-05-21 09:09:27
【问题描述】:
我正在尝试将分面搜索与自定义存储库一起使用,如下所示:
存储库:
public interface POISearchRepository extends CustomSolrRepository, SolrCrudRepository<POISearch, String>
自定义界面:
public interface CustomSolrRepository {
FacetPage<POISearch> facetSearch(String location, String categories, String duration, Pageable page) throws Exception;
}
自定义实现:
@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 {
......
}
不幸的是,我不断收到以下异常:
原因: 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$Predicate.(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 更多
似乎存储库试图解析自定义方法并导致异常(更改方法名称表明)
【问题讨论】:
标签: spring solr spring-data facets spring-data-solr