SpringBoot使用Elasticsearch却扫描不到Repository

在使用spring-data进行ES操作的时候,报找不到Repository错误

Error starting ApplicationContext. To display the conditions report re-run your application with 'debug' enabled.
2020-07-06 18:34:07.085 ERROR 2364 --- [           main] o.s.b.d.LoggingFailureAnalysisReporter   : 

***************************
APPLICATION FAILED TO START
***************************

Description:

Field bookRepository in com.xxximpl.BookServiceImpl required a bean of type 'com.xxximpl.repository.BookRepository' that could not be found.


Action:

Consider defining a bean of type 'com.xxximpl.repository.BookRepository' in your configuration.


Process finished with exit code 1

解决办法就是在启动类加上@EnableElasticsearchRepositories(basePackages = “com.xxximpl.repository”)

你可能感兴趣的:(java,Elasticsearch,SpringBoot)