我正在尝试了解 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/data/solr/showcase/product/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);
}
如果有人能指出这个接口的实现和注入方向,那就太好了。