当尝试将我们的Spring Boot
应用程序从版本2.0.4.RELEASE
升级到版本2.1.6.RELEASE
时,在应用程序启动期间会出现以下错误:
Caused by: java.lang.IllegalStateException: You have defined query method in the repository but you don't have any query lookup strategy defined. The infrastructure apparently does not support query methods!
at org.springframework.data.repository.core.support.RepositoryFactorySupport$QueryExecutorMethodInterceptor.<init>(RepositoryFactorySupport.java:545)
at org.springframework.data.repository.core.support.RepositoryFactorySupport.getRepository(RepositoryFactorySupport.java:324)
at org.springframework.data.repository.core.support.RepositoryFactoryBeanSupport.lambda$afterPropertiesSet$5(RepositoryFactoryBeanSupport.java:297)
at org.springframework.data.util.Lazy.getNullable(Lazy.java:211)
at org.springframework.data.util.Lazy.get(Lazy.java:94)
at org.springframework.data.repository.core.support.RepositoryFactoryBeanSupport.afterPropertiesSet(RepositoryFactoryBeanSupport.java:300)
at org.springframework.data.couchbase.repository.support.CouchbaseRepositoryFactoryBean.afterPropertiesSet(CouchbaseRepositoryFactoryBean.java:105)
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.invokeInitMethods(AbstractAutowireCapableBeanFactory.java:1837)
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.initializeBean(AbstractAutowireCapableBeanFactory.java:1774)
我们有一个Couchbase数据库,这是Repository类:
public interface CatRepository extends CouchbaseRepository<Cat, String>{
Cat findByOwnerNameAndCityName(String ownerName, String cityName);
List<Cat> findAllByOwnerNameOrderByCityName(String ownerName);
List<Cat> findAllByLoveToEatNotLike(String food);
}
我们发现this very similar个问题,最终导致版本降级。
我们还发现this question涉及项目中没有的Flux
。