客户端接入
1、引入jar
<!-- disconf -->
<dependency>
<groupId>com.baidu.disconf</groupId>
<artifactId>disconf-client</artifactId>
<version>2.6.36</version>
<exclusions>
<exclusion>
<groupId>org.apache.zookeeper</groupId>
<artifactId>zookeeper</artifactId>
</exclusion>
</exclusions>
</dependency>
2、配置客户端
在src/main/resources下新建disconf.properties,内容参考如下配置
# 是否使用远程配置文件
# true(默认)会从远程获取配置 false则直接获取本地配置
enable.remote.conf=true
#
# 配置服务器的 HOST,用逗号分隔 127.0.0.1:8000,127.0.0.1:8000
#
conf_server_host=disconftest.imassbank.com
# APP \u8bf7\u91c7\u7528 \u4ea7\u54c1\u7ebf-\u670d\u52a1\u540d \u683c\u5f0f
app=imassbankdemo-web
# 版本, 请采用 X.X.X.X 格式
version=2.0.0
# 环境
env=rd
# 忽略哪些分布式配置,用逗号分隔
ignore=
# 获取远程配置 重试次数,默认是3次
conf_server_url_retry_times=5
# 获取远程配置 重试时休眠时间,默认是5秒
conf_server_url_retry_sleep_seconds=3
3 支持cglib动态代理
<aop:aspectj-autoproxy proxy-target-class="true"/>
4 配置扫描路径
<!-- 使用disconf必须添加以下配置 -->
<bean id="disconfMgrBean" class="com.baidu.disconf.client.DisconfMgrBean"
destroy-method="destroy">
<property name="scanPackage" value="com.imassbank"/>
</bean>
<bean id="disconfMgrBean2" class="com.baidu.disconf.client.DisconfMgrBeanSecond"
init-method="init" destroy-method="destroy">
</bean>