bootstrap-dev.yml配置如下:
spring:
profiles:
active: dev
cloud:
#服务注册和发现
nacos:
discovery:
server-addr: 127.0.0.1:8848
service: ${spring.application.name}
group: xx-service-${spring.profiles.active}
config:
group: xx-service-${spring.profiles.active}
server-addr: 127.0.0.1:8848
file-extension: yml
shared-configs:
- data-id: global-config.yml
group: xx-service-${spring.profiles.active}

注意配置中心Data ID的区别,全局配置必须加上文件后缀.yml;而其他配置因为 file-extension: yml 的存在可以省略后缀。
nocas版本是 2.2.1.RELEASE
本文介绍了Nacos 2.2.1.RELEASE版本的配置文件bootstrap-dev.yml,展示了如何配置服务注册与发现,以及如何设置多环境配置。重点在于全局配置需指定.yml后缀,而其他配置可通过file-extension属性省略后缀。内容涵盖了Nacos的基本用法和配置细节。
2187

被折叠的 条评论
为什么被折叠?



