2013-05-26 22 views
1

我想如下使用面搜索使用自定義存儲庫:春數據的Solr - 異常的映射自定義庫

庫:

public interface POISearchRepository extends CustomSolrRepository, SolrCrudRepository<POISearch, String> 

自定義界面:

public interface CustomSolrRepository { 

    FacetPage<POISearch> facetSearch(String location, String categories, String duration, Pageable page) throws Exception; 
} 

Custom 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 { 

...... 
} 

不幸的是,我不斷收到以下異常:

造成的: org.springframework.data.mapping.PropertyReferenceException:沒有在 org.springframework發現型com.example.domain.POISearch 財產方面。 data.mapping.PropertyPath。(PropertyPath.java:75) 在 org.springframework.data.mapping.PropertyPath.create(PropertyPath.java:327) 在 org.springframework.data.mapping.PropertyPath.create(的PropertyPath .java:353) at 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) 在 組織。 springframework.data.repository.query.parser.PartTree。(P artTree.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(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多個

好像庫試圖解決自定義方法,並且導致異常(改變方法名稱顯示)

回答

2

的問題是與命名爲我的倉庫intrefaces。修正:

庫:POISearchRepository 自定義界面:POISearchRepositoryCustom 客戶實現:POISearchRepositoryImpl

我最初的命名並沒有按照春數據規範