使用com.alibaba.boot配置nacos,一定要在bootstrap.yml内配置nacos的相关配置,而不是application.yml
< parent> < groupId> org.springframework.boot</ groupId> < artifactId> spring-boot-starter-parent</ artifactId> < version> 2.4.8</ version> < relativePath/>
</ parent>
...
...
< dependency> < groupId> com.alibaba.boot</ groupId> < artifactId> nacos-config-spring-boot-starter</ artifactId> < version> 0.2.7</ version>
</ dependency>
< dependency> < groupId> org.springframework.cloud</ groupId> < artifactId> spring-cloud-starter-bootstrap</ artifactId> < version> 3.0.3</ version>
</ dependency>
yml配置(nacos-config-spring-boot-starter)
nacos : config : server-addr : 192.168.11.47: 18848 bootstrap : enable :