在自定义的单个存储库实现(spring-data documents)中,有什么方法可以获取EntityInformation? 这是我的代码:
与 MongoSearchRepository 接口与搜索方法:
public interface MongoSearchRepository<T, ID> {
List<T> searchByPage(String keyword, T example, Pageable page);
}
实施 MongoSearchRepositoryImpl :
public class MongoSearchRepositoryImpl<T, ID> implements MongoSearchRepository<T, ID> {
protected MongoOperations mongoOperations;
@Autowired
public MongoSearchRepositoryImpl(MongoOperations mongoOperations) {
this.mongoOperations = mongoOperations;
}
@Override
public List<T> searchByPage(String keyword, T example, Pageable page) {
Query query = ...;
return this.mongoOperations.find(
query,
this.getEntityInformation().getJavaType(),
this.getEntityInformation().getCollectionName());
}
现在按如下所示使用MongoSearchRepository:
@Repository
public interface ProductRepository
extends MongoCrudRepository<Product, String>,
MongoSearchRepository<Product, String>
然后我的问题是,我无法在MongoSearchRepositoryImpl中实现getEntityInformation。
非常感谢您的帮助。