环境:SpringBoot 使用 elasticsearch中出现的问题
报错:
***************************
APPLICATION FAILED TO START
***************************
Description:
Field articleDao in com.tensquare.search.service.ArticleService required a bean named 'elasticsearchTemplate' that could not be found.
Action:
Consider defining a bean named 'elasticsearchTemplate' in your configuration.
想法:在ArticleService 类中并没有用到elasticsearchTemplate,所以检查了一下导包及配置情况,发现是配置信息写错了。
出错位置:
解决办法:
server:
port: 9007
spring:
application:
name: tensquare-search
data:
elasticsearch:
cluster-nodes: 127.0.0.1:9300