1. Disconf 的安装
参考文档:https://blog.csdn.net/u014687848/article/details/80876510
2.Disconf的使用
官方文档: https://disconf.readthedocs.io/zh_CN/latest/index.html
博客参考文档:https://blog.csdn.net/lby0307/article/details/80100319
第一步:添加disconf的maven支持
<dependency>
<groupId>com.baidu.disconf</groupId>
<artifactId>disconf-client</artifactId>
<version>2.6.36</version>
</dependency>
第二步:创建disconf.properties
# 是否使用远程配置文件
# true(默认)会从远程获取配置 false则直接获取本地配置
disconf.enable.remote.conf=true
#
# 配置服务器的 HOST,用逗号分隔 127.0.0.1:8000,127.0.0.1:8000
#搭建的服务器的路径
disconf.conf_server_host=127.0.0.1:8083
# 版本, 请采用 X_X_X_X 格式
disconf.version=1.0.0
# APP 请采用 产品线_服务名 格式
disconf.app=testBook
# 环境
disconf.env=qa
# 忽略哪些分布式配置,用逗号分隔
disconf.ignore=
# 获取远程配置 重试次数,默认是3次
disconf.conf_server_url_retry_times=1
# 获取远程配置 重试时休眠时间,默认是5秒
disconf.conf_server_url_retry_sleep_seconds=1
# 自定义的下载路径
disconf.user_define_download_dir=./archetype205-service/src/main/resources/config/
#disconf.enable_local_download_dir_in_class_path=truea
第三步:创建disconf的java配置类 或xml
(二选一)xml形式:
disconf.xml