使用Apollo管理Springboot配置文件的相关配置

1,引入Maven依赖:

<dependency>
		<groupId>com.ctrip.framework.apollo</groupId>
		<artifactId>apollo-client</artifactId>
		<version>1.0.0</version>
</dependency>

2,添加配置文件app.properties:

app.id=bidding

3,添加到配置文件application-dev.properties:

dev.meta=http://192.168.1.235:18080

添加到配置文件application-sit.properties:

sit.meta=http://192.168.1.235:18081

添加到配置文件application-uat.properties:

uat.meta=http://192.168.1.235:18082

4, 创建系统缓存目录:

Mac/Linux: /opt/data/
Windows: C:\opt\data\

5, 配置系统环境信息:

对于Mac/Linux,文件位置为/opt/settings/server.properties
对于Windows,文件位置为C:\opt\settings\server.properties
文件内容为:env=DEV,大小写不敏感(其它环境如sit,uat)

6, 托管application.properties的内容,删除除日志文件配置的其它配置信息:

保留:logging.config=classpath:saas_logger-dev.xml

注意:本地配置的日志文件配置信息不能删除,否则程序无法运行。

猜你喜欢

转载自blog.csdn.net/qq_15070281/article/details/83583552
今日推荐