我正在尝试了解Spring Data Solr展示项目。
https://github.com/christophstrobl/spring-data-solr-showcase
花费相当多的时间后,我找不到productRepository是如何实现的,并注入在https://github.com/christophstrobl/spring-data-solr-showcase/blob/master/src/main/java/org/ springframework /数据/太阳能/展示柜/产品/ProductServiceImpl.java
@Service class ProductServiceImpl implements ProductService {
private static final Pattern IGNORED_CHARS_PATTERN = Pattern.compile("\\p{Punct}");
private ProductRepository productRepository;
@Autowired
public void setProductRepository(ProductRepository productRepository) {
this.productRepository = productRepository;
}
ProductRepository定义为接口(https://github.com/christophstrobl/spring-data-solr-showcase/blob/master/src/main/java/org/springframework/data/solr/showcase/product/ProductRepository.java),我没有找到实现此接口的任何代码
interface ProductRepository extends SolrCrudRepository<Product, String> {
@Highlight(prefix = "<b>", postfix = "</b>")
@Query(fields = { SearchableProductDefinition.ID_FIELD_NAME,
SearchableProductDefinition.NAME_FIELD_NAME,
SearchableProductDefinition.PRICE_FIELD_NAME,
SearchableProductDefinition.FEATURES_FIELD_NAME,
SearchableProductDefinition.AVAILABLE_FIELD_NAME },
defaultOperator = Operator.AND)
HighlightPage<Product> findByNameIn(Collection<String> names, Pageable page);
@Facet(fields = { SearchableProductDefinition.NAME_FIELD_NAME })
FacetPage<Product> findByNameStartsWith(Collection<String> nameFragments, Pageable pagebale);
}
下面是如何配置spring上下文:https : //github.com/christophstrobl/spring-data-solr-showcase/blob/master/src/main/java/org/springframework/data/solr/showcase/Application.java
如果有人能指出我实现和注入此接口的方向,那将很棒。
本文收集自互联网,转载请注明来源。
如有侵权,请联系[email protected] 删除。
我来说两句