1、配置相同dataId不同group
2、配置
3、配置yml
spring:
profiles:
active: info
# active: test
# active: dev
在config下添加group配置
server:
port: 3377
spring:
application:
name: nacos-config-client
cloud:
nacos:
discovery:
server-addr: localhost:8848 # nacos服务注册中心
config:
server-addr: localhost:8848
file-extension: yaml # 指定yaml为配置文件后缀
group: DEV_GROUP
# ${prefix}-${spring-profile.active}.${file-extension}
# 约定配置文件名
# ${spring.application.name}-${spring.profile.active}.${spring.cloud.nacos.config.file-extension}
# nacos-config-client-dev.yaml
4、启动服务并访问:http://localhost:3377/config/info