shared-dataids和refreshable-dataids属性,默认的分组是DEFAULT_GROUP,配置如下:
# Spring
spring:
application:
# 应用名称
name: mall-gateway
cloud:
nacos:
config:
enabled: true
# 配置中心地址
server-addr: localhost:8848
# 配置文件格式
file-extension: yaml
shared-dataids: mall-db-common.yaml
refreshable-dataids: mall-db-common.yaml
group: MALL_GROUP
namespace: 3e7e6576-7a09-4321-bcb1-ca144ef329d9
context-path: nacos
username: nacos
password: nacos
data-id: mall-gateway.yaml
如果指定了其他分组,必须单独指定分组,不然找不到配置报错,正确配置如下:
# Spring
spring:
application:
# 应用名称
name: mall-gateway
cloud:
nacos:
config:
enabled: true
# 配置中心地址
server-addr: localhost:8848
# 配置文件格式
file-extension: yaml
group: MALL_GROUP
namespace: 3e7e6576-7a09-4321-bcb1-ca144ef329d9
context-path: nacos
username: nacos
password: nacos
data-id: mall-gateway.yaml
ext-config:
- data-id: mall-db.common.yaml
group: MALL_GROUP
refresh: true