nacos配置二


启动客户端,默认登录密码是nacos,nacos:
sh startup.sh -m standalone
@SpringBootApplication
@EnableDiscoveryClient
public class wangbiao {
    public static void main(String[] args) {
        SpringApplication.run(wangbiao.class,args);
    }
}
server:
  port: 8081

spring:
  application:
    name: cloud-pay-nacos
  cloud:
    nacos:
#      注册
      discovery:
        server-addr: 127.0.0.1:8848

#暴露信息
management:
  endpoints:
    web:
      exposure:
        include: '*'
通过配置环境也可以选择不同环境的配置文件
#指定开发环境
spring:
  profiles:
    active: info
#    active: dev
#    active: info

 此时的配置就是:

在不同命名空间下,不同分组,不同环境下的配置:

命名空间:c0934705-60bc-431c-ac3f-4e955b6fef54
分组:DEV_GROUP
环境:info



如下:server:
  port: 8082

spring:
  application:
    name: cloud-pay-nacosc
  cloud:
    nacos:
      #      注册
      discovery:
        server-addr: 127.0.0.1:8848
      config:
        server-addr: 127.0.0.1:8848
        file-extension: yaml
        group: DEV_GROUP
        namespace: c0934705-60bc-431c-ac3f-4e955b6fef54
#暴露信息
management:
  endpoints:
    web:
      exposure:
        include: '*'