nacos加载公共配置

spring:
  application:
    name: nacos-demo
  cloud:
    nacos:
      server-addr: 192.168.1.125:8848
      username: nacos
      password: nacos
      config:   # shared-configs[n] n的值越大优先级越高
        shared-configs[0]:
          data-id: db.yaml
          group: DEFAULT_GROUP   # 默认为DEFAULT_GROUP
          refresh: true   # 是否动态刷新,默认为false
        shared-configs[1]:
          data-id: test.yaml
          group: DEFAULT_GROUP
          refresh: true
        shared-configs[2]:
          data-id: test2.yaml
          group: DEFAULT_GROUP
          refresh: true
        extension-configs[0]:  #  extension-configs[n] n的值越大优先级越高
          data-id: test3.yaml
          group: DEFAULT_GROUP
          refresh: true
        extension-configs[1]:
          data-id: test4.yaml
          group: DEFAULT_GROUP
          refresh: true
        file-extension: yaml
        namespace: sit  # 切换环境
        name: nacos  # 指定配置文件的名称,默认为spring.application.name
        # 优先级    本身(file-extension) > extension-configs[n] > shared-configs[n]
        # 另外n的值越大优先级越高  

你可能感兴趣的:(spring,cloud,spring,后端)