导入config依赖导致
spring-cloud-starter-consul-config 这个配置包不知道有啥用 但是导入之后配置host和port会失效,启动还是连接的本地localhost(127.0.0.1)
之前在网上学这么使用consul会有一些教程会加入这个依赖。
<dependency>
<groupId>org.springframework.cloud</groupId>
<artifactId>spring-cloud-starter-consul-config</artifactId>
</dependency>
这个把这个依赖删了就行