Disconf接入文档

客户端接入

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>

配置项接入

输入图片说明

配置文件接入

输入图片说明

预加载配置文件,支持PropertyPlaceholderConfigurer

输入图片说明

转载于:https://my.oschina.net/liangxiao/blog/1789842

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值