Nacos官网地址
这里下载的是1.3.2的版本,其他环境启动命令请看官网
<dependency>
<groupId>com.alibaba.boot</groupId>
<artifactId>nacos-config-spring-boot-starter</artifactId>
</dependency>
# 指定环境
spring.profiles.active=dev
# 应用名字
spring.application.name=auto-deployed
# 开启自动刷新
nacos.config.auto-refresh=true
# 所属组
nacos.config.group=DEFAULT_GROUP
# 测试使用的配置文件
nacos.config.data-id=auto-deployed.yaml
# 命名空间(必须指定,就是通过命名空间来做多环境配置的)
nacos.config.namespace=PRD
nacos.config.server-addr=127.0.0.1:8848
# 配置类型
nacos.config.type=yaml
# 开启配置预加载功能
nacos.config.bootstrap.enable=true
# 开启自动刷新
nacos.config.auto-refresh=true
# 所属组
nacos.config.group=DEFAULT_GROUP
# 测试使用的配置文件
nacos.config.data-id=auto-deployed.yaml
# 命名空间(必须指定,就是通过命名空间来做多环境配置的)
nacos.config.namespace=DEV
nacos.config.server-addr=127.0.0.1:8848
# 配置类型
nacos.config.type=yaml
# 开启配置预加载功能
nacos.config.bootstrap.enable=true
切换环境后,访问test资源地址可以查看内容的变化
扫码关注腾讯云开发者
领取腾讯云代金券
Copyright © 2013 - 2025 Tencent Cloud. All Rights Reserved. 腾讯云 版权所有
深圳市腾讯计算机系统有限公司 ICP备案/许可证号:粤B2-20090059 深公网安备号 44030502008569
腾讯云计算(北京)有限责任公司 京ICP证150476号 | 京ICP备11018762号 | 京公网安备号11010802020287
Copyright © 2013 - 2025 Tencent Cloud.
All Rights Reserved. 腾讯云 版权所有