我使用的是自定义的Spring数据存储库实现/扩展(示例here之一),但我仍想使用Optionals进行基本操作 - 下面(例如对于蒙戈或Elasticsearch):spring-data both:自定义存储库和开箱即用的optionals
public interface DomainRepository extends MongoRepository<Domain, Long>, DomainRepositoryCustomAnyName {
Optional<Domain> findOne(Long id);
}
在不需要FPGA实现的是对我自己的方法,我DomainRepositoryImpl类(实现DomainRepositoryCustomAnyName)。
这是否有可能?
目前,我发现了一个异常(同为一个示意我应该实现方法在我DomainRepositoryImpl类):Caused by: org.springframework.data.mapping.PropertyReferenceException: No property findOne found for type Domain