Nacos作为配置中心使用
1.添加依赖
<dependency>
<groupId>com.alibaba.boot</groupId>
<artifactId>nacos-config-spring-boot-starter</artifactId>
<version>0.2.4</version>
</dependency>
2.配置文件
nacos.config.server-addr=127.0.0.1:8848
nacos.config.namespace=97a22b88-2d8d-40a3-baa4-836ed23f8da2
nacos.config.group=bf
3.启动类添加注解@NacosPropertySource
@NacosPropertySource(dataId = "business-finance.properties", groupId = "bf", autoRefreshed = true)
4.代码中使用@Value
@Value("${xxl.job.admin.addresses}")
private String adminAddresses;