SpringCloud实战三十二:nacos配置group

  作者:记性不好的阁主

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










相关推荐

评论 抢沙发

表情

分类选择