启动报错:
配置文件:
server:
port: 9007
spring:
application:
name: tensquare_search #指定服务名
data:
elasticsearch:
cluster-nodes: 192.168.225.100:9300
pom依赖:
<?xml version="1.0" encoding="UTF-8"?>
<project xmlns="http://maven.apache.org/POM/4.0.0"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<parent>
<artifactId>tensquare_parent</artifactId>
<groupId>com.wch</groupId>
<version>1.0-SNAPSHOT</version>
</parent>
<modelVersion>4.0.0</modelVersion>
<artifactId>tensquare_search</artifactId>
<dependencies>
<dependency>
<groupId>com.wch</groupId>
<artifactId>tensquare_common</artifactId>
<version>1.0-SNAPSHOT</version>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-data-elasticsearch</artifactId>
</dependency>
</dependencies>
</project>
异常原因:因为启动配置中(application.properties) 缺少加有关elasticsearch的配置
经过百度发现是缺少相关配置,但是检查自己的配置是有的,最有发现是配置层级关系写错了,
更改后的配置文件如下:
server:
port: 9007
spring:
application:
name: tensquare_search #指定服务名
data:
elasticsearch:
cluster-nodes: 192.168.225.100:9300
重新启动: