springboot 集成disconf
关于分布式下的统一配置, 我们公司都用的是百度开源的disconf,虽然是一个半成品,但也能满足我们的需求,先看一下目录结构
首先 新建profile目录,下属两个文件夹,aliyun_prod 对应生产,test对应测试环境
test目录下采用yml格式来定义disconf的配置如下
disconf:
enable:
remote:
conf: true
conf_server_host: 127.0.0.1:3079
version: 1_0_0_0
app: paidui_soa
env: LOCAL
conf_server_url_retry_times: 2
conf_server_url_retry_sleep_seconds: 1
enable_local_download_dir_in_class_path: true
然后导入spring-disconf.xml
<?xml version="1.0" encoding="UTF-8"?>
<beans xmlns="http://www.springframework.org/schema/beans"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:aop="http://www.springframework.org/schema/aop"
xsi:schemaLocation="http://www.springframework.org/schema/beans
http://www.springframework.org/schema/beans/spring-beans.xsd">
<!-- disconf 配置开始 -->
<bean id="disconfMgrBean" class="com.baidu.disconf.client.DisconfMgrBean"
destroy-method="destroy">
<property name="scanPackage&#