spring結合disconf的使用說明

一挣棕、浩言

林中有鹿译隘,鹿有孤獨,頭上有角洛心,心中有夢

二固耘、背景

昨天配置完,晚上就加班測試spring連接問題词身,可是我測試到八點半厅目,我還是沒有獲取到配置文件數據,然后就下班路上思考了下偿枕,今天早上來璧瞬,又重新看了下配置户辫,才發(fā)現是自己沒有修改掃描的包位置渐夸,造成之前每次都是沒找到指定的配置文件。

三渔欢、配置

3.1 問題

這是昨天測試打印的日志墓塌,一直說找不到

.14:45:46.976 DEBUG [main] com.baidu.disconf.client.store.processor.impl.DisconfStoreFileProcessorImpl[181] - cannot find redis.properties, host in store....
.14:45:47.009 DEBUG [main] com.baidu.disconf.client.store.processor.impl.DisconfStoreFileProcessorImpl[181] - cannot find redis.properties, port in store....
null    ================>   null

3.2 相關配置及代碼

<?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
        http://www.springframework.org/schema/aop
        http://www.springframework.org/schema/aop/spring-aop-3.0.xsd">


    <aop:aspectj-autoproxy proxy-target-class="true"/>

    <!-- 使用disconf必須添加以下配置 -->
    <bean id="disconfMgrBean" class="com.baidu.disconf.client.DisconfMgrBean"
          destroy-method="destroy">
        <!-- 一定注意修改這里掃描包的路徑,我就在這里吃虧了-->
        <property name="scanPackage" value="com.mouse.moon.disconf"/>
    </bean>

    <bean id="disconfMgrBean2" class="com.baidu.disconf.client.DisconfMgrBeanSecond"
          init-method="init" destroy-method="destroy">
    </bean>


    <!-- 使用托管方式的disconf配置(無代碼侵入, 配置更改會自動reload)-->
    <bean id="configproperties_disconf"
          class="com.baidu.disconf.client.addons.properties.ReloadablePropertiesFactoryBean">
        <property name="locations">
            <list>
                <value>autoconfig.properties</value>
                <value>redis.properties</value>
            </list>
        </property>
    </bean>

    <bean id="propertyConfigurer"
         class="com.baidu.disconf.client.addons.properties.ReloadingPropertyPlaceholderConfigurer">
        <property name="ignoreResourceNotFound" value="true"/>
        <property name="ignoreUnresolvablePlaceholders" value="true"/>
        <property name="propertiesArray">
            <list>
                <ref bean="configproperties_disconf"/>
            </list>
        </property>
    </bean>

   <bean id="simpleConfig" class="com.mouse.moon.disconf.SimpleConfig"/>
</beans>

在resources目錄下配置disconf.properties

disconf.enable.remote.conf=true

disconf.conf_server_host=10.10.39.105:8081

###我這是測試使用,推薦用 X_X_X_X 格式
disconf.version=0.0.1

###disconf.version=V2

# APP 請采用 產品線_服務名 格式
disconf.app=test

disconf.env=local

disconf.ignore=

disconf.conf_server_url_retry_sleep_seconds=1

###disconf.user_define_download_dir=./

disconf.user_define_download_dir=./disconf/download

# 下載的文件會被遷移到classpath根路徑下奥额,強烈建議將此選項置為 true(默認是true)
disconf.enable_local_download_dir_in_class_path=true

package com.mouse.moon.disconf;

import com.baidu.disconf.client.common.annotations.DisconfFile;
import com.baidu.disconf.client.common.annotations.DisconfFileItem;
import org.springframework.context.annotation.Scope;
import org.springframework.stereotype.Component;
import org.springframework.stereotype.Service;

/**
* Created by Mahone Wu on 2017/3/28.
*/
@Service
@Scope("singleton")
@DisconfFile(filename = "redis.properties")
public class SimpleConfig {

   // 代表連接地址
   private String host;

   // 代表連接port
   private String port;

   /**
    * 地址
    *
    * @return
    */
   @DisconfFileItem(name = "host", associateField = "host")
   public String getHost() {
       return host;
   }

   public void setHost(String host) {
       this.host = host;
   }

   /**
    * 端口
    *
    * @return
    */
   @DisconfFileItem(name = "port", associateField = "port")
   public String getPort() {
       return port;
   }

   public void setPort(String port) {
       this.port = port;
   }
}

打印日志如下:

package com.mouse.moon.disconf;
import org.springframework.context.ApplicationContext;
import org.springframework.context.support.ClassPathXmlApplicationContext;

/**
 * Created by Mahone Wu on 2017/3/28.
 */
public class AppMain {
    public static void main(String[] args) {
        ApplicationContext factory = new ClassPathXmlApplicationContext("classpath:disconf.xml");
        SimpleConfig  redis = (SimpleConfig )factory.getBean("simpleConfig");
        System.out.println(redis.getHost() + "\t================>\t" + redis.getPort());
    }
}
Paste_Image.png
13:56:29.006 INFO [main] com.baidu.disconf.client.DisconfMgr[84] - ******************************* DISCONF START FIRST SCAN *******************************
.13:56:29.022 DEBUG [main] com.baidu.disconf.client.scan.impl.ScanMgrImpl[65] - start to scan package: [com.mouse.moon.disconf]
.13:56:29.055 DEBUG [main] org.reflections.Reflections[186] - going to scan these urls:
file:/D:/wuhaoWorkSpace/Mygithub/mouse-disconf/target/classes/
.13:56:29.075 INFO [main] org.reflections.Reflections[224] - Reflections took 20 ms to scan 1 urls, producing 7 keys and 23 values 
.13:56:29.366 DEBUG [main] com.baidu.disconf.core.common.utils.http.HttpClientUtil[58] - request: content-type  application/json
.13:56:29.375 DEBUG [main] org.apache.http.client.protocol.RequestAddCookies[122] - CookieSpec selected: default
.13:56:29.396 DEBUG [main] org.apache.http.client.protocol.RequestAuthCache[76] - Auth cache not set in the context
.13:56:29.412 DEBUG [main] org.apache.http.impl.conn.PoolingHttpClientConnectionManager[249] - Connection request: [route: {}->http://10.10.39.105:8081][total kept alive: 0; route allocated: 0 of 2; total allocated: 0 of 20]
.13:56:29.412 DEBUG [main] org.apache.http.impl.conn.PoolingHttpClientConnectionManager[282] - Connection leased: [id: 0][route: {}->http://10.10.39.105:8081][total kept alive: 0; route allocated: 1 of 2; total allocated: 1 of 20]
.13:56:29.412 DEBUG [main] org.apache.http.impl.execchain.MainClientExec[234] - Opening connection {}->http://10.10.39.105:8081
.13:56:29.412 DEBUG [main] org.apache.http.impl.conn.DefaultHttpClientConnectionOperator[131] - Connecting to /10.10.39.105:8081
.13:56:29.413 DEBUG [main] org.apache.http.impl.conn.DefaultHttpClientConnectionOperator[138] - Connection established 10.10.152.99:60871<->10.10.39.105:8081
.13:56:29.413 DEBUG [main] org.apache.http.impl.conn.DefaultManagedHttpClientConnection[90] - http-outgoing-0: set socket timeout to 5000
.13:56:29.413 DEBUG [main] org.apache.http.impl.execchain.MainClientExec[255] - Executing request GET /api/zoo/hosts HTTP/1.1
.13:56:29.413 DEBUG [main] org.apache.http.impl.execchain.MainClientExec[260] - Target auth state: UNCHALLENGED
.13:56:29.413 DEBUG [main] org.apache.http.impl.execchain.MainClientExec[266] - Proxy auth state: UNCHALLENGED
.13:56:29.413 DEBUG [main] org.apache.http.headers[135] - http-outgoing-0 >> GET /api/zoo/hosts HTTP/1.1
.13:56:29.413 DEBUG [main] org.apache.http.headers[138] - http-outgoing-0 >> content-type: application/json
.13:56:29.413 DEBUG [main] org.apache.http.headers[138] - http-outgoing-0 >> Host: 10.10.39.105:8081
.13:56:29.413 DEBUG [main] org.apache.http.headers[138] - http-outgoing-0 >> Connection: Keep-Alive
.13:56:29.413 DEBUG [main] org.apache.http.headers[138] - http-outgoing-0 >> User-Agent: Apache-HttpClient/4.5.1 (Java/1.8.0_77)
.13:56:29.413 DEBUG [main] org.apache.http.headers[138] - http-outgoing-0 >> Accept-Encoding: gzip,deflate
.13:56:29.413 DEBUG [main] org.apache.http.wire[72] - http-outgoing-0 >> "GET /api/zoo/hosts HTTP/1.1[\r][\n]"
.13:56:29.413 DEBUG [main] org.apache.http.wire[72] - http-outgoing-0 >> "content-type: application/json[\r][\n]"
.13:56:29.413 DEBUG [main] org.apache.http.wire[72] - http-outgoing-0 >> "Host: 10.10.39.105:8081[\r][\n]"
.13:56:29.413 DEBUG [main] org.apache.http.wire[72] - http-outgoing-0 >> "Connection: Keep-Alive[\r][\n]"
.13:56:29.413 DEBUG [main] org.apache.http.wire[72] - http-outgoing-0 >> "User-Agent: Apache-HttpClient/4.5.1 (Java/1.8.0_77)[\r][\n]"
.13:56:29.413 DEBUG [main] org.apache.http.wire[72] - http-outgoing-0 >> "Accept-Encoding: gzip,deflate[\r][\n]"
.13:56:29.413 DEBUG [main] org.apache.http.wire[72] - http-outgoing-0 >> "[\r][\n]"
.13:56:29.413 DEBUG [main] org.apache.http.wire[72] - http-outgoing-0 << "HTTP/1.1 200 OK[\r][\n]"
.13:56:29.413 DEBUG [main] org.apache.http.wire[72] - http-outgoing-0 << "Date: Wed, 29 Mar 2017 05:58:52 GMT[\r][\n]"
.13:56:29.413 DEBUG [main] org.apache.http.wire[72] - http-outgoing-0 << "Content-Type: application/json;charset=UTF-8[\r][\n]"
.13:56:29.413 DEBUG [main] org.apache.http.wire[72] - http-outgoing-0 << "Transfer-Encoding: chunked[\r][\n]"
.13:56:29.413 DEBUG [main] org.apache.http.wire[72] - http-outgoing-0 << "Connection: keep-alive[\r][\n]"
.13:56:29.413 DEBUG [main] org.apache.http.wire[72] - http-outgoing-0 << "Server: Apache-Coyote/1.1[\r][\n]"
.13:56:29.413 DEBUG [main] org.apache.http.wire[72] - http-outgoing-0 << "[\r][\n]"
.13:56:29.413 DEBUG [main] org.apache.http.wire[72] - http-outgoing-0 << "35[\r][\n]"
.13:56:29.413 DEBUG [main] org.apache.http.wire[72] - http-outgoing-0 << "{"status":1,"message":"","value":"10.10.39.105:2181"}[\r][\n]"
.13:56:29.413 DEBUG [main] org.apache.http.wire[72] - http-outgoing-0 << "0[\r][\n]"
.13:56:29.413 DEBUG [main] org.apache.http.wire[72] - http-outgoing-0 << "[\r][\n]"
.13:56:29.413 DEBUG [main] org.apache.http.headers[124] - http-outgoing-0 << HTTP/1.1 200 OK
.13:56:29.413 DEBUG [main] org.apache.http.headers[127] - http-outgoing-0 << Date: Wed, 29 Mar 2017 05:58:52 GMT
.13:56:29.413 DEBUG [main] org.apache.http.headers[127] - http-outgoing-0 << Content-Type: application/json;charset=UTF-8
.13:56:29.413 DEBUG [main] org.apache.http.headers[127] - http-outgoing-0 << Transfer-Encoding: chunked
.13:56:29.413 DEBUG [main] org.apache.http.headers[127] - http-outgoing-0 << Connection: keep-alive
.13:56:29.413 DEBUG [main] org.apache.http.headers[127] - http-outgoing-0 << Server: Apache-Coyote/1.1
.13:56:29.414 DEBUG [main] org.apache.http.impl.execchain.MainClientExec[284] - Connection can be kept alive for 5000 MILLISECONDS
.13:56:29.438 DEBUG [main] com.baidu.disconf.core.common.utils.http.HttpClientUtil[66] - response header: Date  Wed, 29 Mar 2017 05:58:52 GMT
.13:56:29.438 DEBUG [main] com.baidu.disconf.core.common.utils.http.HttpClientUtil[66] - response header: Content-Type  application/json;charset=UTF-8
.13:56:29.439 DEBUG [main] com.baidu.disconf.core.common.utils.http.HttpClientUtil[66] - response header: Transfer-Encoding chunked
.13:56:29.439 DEBUG [main] com.baidu.disconf.core.common.utils.http.HttpClientUtil[66] - response header: Connection    keep-alive
.13:56:29.439 DEBUG [main] com.baidu.disconf.core.common.utils.http.HttpClientUtil[66] - response header: Server    Apache-Coyote/1.1
.13:56:29.439 INFO [main] com.baidu.disconf.core.common.utils.http.HttpClientUtil[81] - execute http request [null], status code [200]
.13:56:29.439 DEBUG [main] org.apache.http.impl.conn.PoolingHttpClientConnectionManager[314] - Connection [id: 0][route: {}->http://10.10.39.105:8081] can be kept alive for 5.0 seconds
.13:56:29.439 DEBUG [main] org.apache.http.impl.conn.PoolingHttpClientConnectionManager[320] - Connection released: [id: 0][route: {}->http://10.10.39.105:8081][total kept alive: 1; route allocated: 1 of 2; total allocated: 1 of 20]
.13:56:29.471 DEBUG [main] com.baidu.disconf.client.fetcher.impl.FetcherMgrImpl[77] - remote server return: ValueVo [status=1, message=, value=10.10.39.105:2181]
.13:56:29.471 DEBUG [main] com.baidu.disconf.core.common.utils.http.HttpClientUtil[58] - request: content-type  application/json
.13:56:29.471 DEBUG [main] org.apache.http.client.protocol.RequestAddCookies[122] - CookieSpec selected: default
.13:56:29.471 DEBUG [main] org.apache.http.client.protocol.RequestAuthCache[76] - Auth cache not set in the context
.13:56:29.471 DEBUG [main] org.apache.http.impl.conn.PoolingHttpClientConnectionManager[249] - Connection request: [route: {}->http://10.10.39.105:8081][total kept alive: 1; route allocated: 1 of 2; total allocated: 1 of 20]
.13:56:29.471 DEBUG [main] org.apache.http.impl.conn.PoolingHttpClientConnectionManager[282] - Connection leased: [id: 0][route: {}->http://10.10.39.105:8081][total kept alive: 0; route allocated: 1 of 2; total allocated: 1 of 20]
.13:56:29.471 DEBUG [main] org.apache.http.impl.conn.DefaultManagedHttpClientConnection[90] - http-outgoing-0: set socket timeout to 5000
.13:56:29.471 DEBUG [main] org.apache.http.impl.execchain.MainClientExec[255] - Executing request GET /api/zoo/prefix HTTP/1.1
.13:56:29.471 DEBUG [main] org.apache.http.impl.execchain.MainClientExec[260] - Target auth state: UNCHALLENGED
.13:56:29.471 DEBUG [main] org.apache.http.impl.execchain.MainClientExec[266] - Proxy auth state: UNCHALLENGED
.13:56:29.471 DEBUG [main] org.apache.http.headers[135] - http-outgoing-0 >> GET /api/zoo/prefix HTTP/1.1
.13:56:29.471 DEBUG [main] org.apache.http.headers[138] - http-outgoing-0 >> content-type: application/json
.13:56:29.471 DEBUG [main] org.apache.http.headers[138] - http-outgoing-0 >> Host: 10.10.39.105:8081
.13:56:29.471 DEBUG [main] org.apache.http.headers[138] - http-outgoing-0 >> Connection: Keep-Alive
.13:56:29.471 DEBUG [main] org.apache.http.headers[138] - http-outgoing-0 >> User-Agent: Apache-HttpClient/4.5.1 (Java/1.8.0_77)
.13:56:29.471 DEBUG [main] org.apache.http.headers[138] - http-outgoing-0 >> Accept-Encoding: gzip,deflate
.13:56:29.471 DEBUG [main] org.apache.http.wire[72] - http-outgoing-0 >> "GET /api/zoo/prefix HTTP/1.1[\r][\n]"
.13:56:29.471 DEBUG [main] org.apache.http.wire[72] - http-outgoing-0 >> "content-type: application/json[\r][\n]"
.13:56:29.471 DEBUG [main] org.apache.http.wire[72] - http-outgoing-0 >> "Host: 10.10.39.105:8081[\r][\n]"
.13:56:29.471 DEBUG [main] org.apache.http.wire[72] - http-outgoing-0 >> "Connection: Keep-Alive[\r][\n]"
.13:56:29.471 DEBUG [main] org.apache.http.wire[72] - http-outgoing-0 >> "User-Agent: Apache-HttpClient/4.5.1 (Java/1.8.0_77)[\r][\n]"
.13:56:29.471 DEBUG [main] org.apache.http.wire[72] - http-outgoing-0 >> "Accept-Encoding: gzip,deflate[\r][\n]"
.13:56:29.471 DEBUG [main] org.apache.http.wire[72] - http-outgoing-0 >> "[\r][\n]"
.13:56:29.486 DEBUG [main] org.apache.http.wire[72] - http-outgoing-0 << "HTTP/1.1 200 OK[\r][\n]"
.13:56:29.486 DEBUG [main] org.apache.http.wire[72] - http-outgoing-0 << "Date: Wed, 29 Mar 2017 05:58:52 GMT[\r][\n]"
.13:56:29.486 DEBUG [main] org.apache.http.wire[72] - http-outgoing-0 << "Content-Type: application/json;charset=UTF-8[\r][\n]"
.13:56:29.486 DEBUG [main] org.apache.http.wire[72] - http-outgoing-0 << "Transfer-Encoding: chunked[\r][\n]"
.13:56:29.486 DEBUG [main] org.apache.http.wire[72] - http-outgoing-0 << "Connection: keep-alive[\r][\n]"
.13:56:29.486 DEBUG [main] org.apache.http.wire[72] - http-outgoing-0 << "Server: Apache-Coyote/1.1[\r][\n]"
.13:56:29.486 DEBUG [main] org.apache.http.wire[72] - http-outgoing-0 << "[\r][\n]"
.13:56:29.486 DEBUG [main] org.apache.http.wire[72] - http-outgoing-0 << "2c[\r][\n]"
.13:56:29.486 DEBUG [main] org.apache.http.wire[72] - http-outgoing-0 << "{"status":1,"message":"","value":"/disconf"}[\r][\n]"
.13:56:29.486 DEBUG [main] org.apache.http.wire[72] - http-outgoing-0 << "0[\r][\n]"
.13:56:29.486 DEBUG [main] org.apache.http.wire[72] - http-outgoing-0 << "[\r][\n]"
.13:56:29.486 DEBUG [main] org.apache.http.headers[124] - http-outgoing-0 << HTTP/1.1 200 OK
.13:56:29.486 DEBUG [main] org.apache.http.headers[127] - http-outgoing-0 << Date: Wed, 29 Mar 2017 05:58:52 GMT
.13:56:29.486 DEBUG [main] org.apache.http.headers[127] - http-outgoing-0 << Content-Type: application/json;charset=UTF-8
.13:56:29.486 DEBUG [main] org.apache.http.headers[127] - http-outgoing-0 << Transfer-Encoding: chunked
.13:56:29.486 DEBUG [main] org.apache.http.headers[127] - http-outgoing-0 << Connection: keep-alive
.13:56:29.486 DEBUG [main] org.apache.http.headers[127] - http-outgoing-0 << Server: Apache-Coyote/1.1
.13:56:29.486 DEBUG [main] org.apache.http.impl.execchain.MainClientExec[284] - Connection can be kept alive for 5000 MILLISECONDS
.13:56:29.486 DEBUG [main] com.baidu.disconf.core.common.utils.http.HttpClientUtil[66] - response header: Date  Wed, 29 Mar 2017 05:58:52 GMT
.13:56:29.486 DEBUG [main] com.baidu.disconf.core.common.utils.http.HttpClientUtil[66] - response header: Content-Type  application/json;charset=UTF-8
.13:56:29.486 DEBUG [main] com.baidu.disconf.core.common.utils.http.HttpClientUtil[66] - response header: Transfer-Encoding chunked
.13:56:29.486 DEBUG [main] com.baidu.disconf.core.common.utils.http.HttpClientUtil[66] - response header: Connection    keep-alive
.13:56:29.486 DEBUG [main] com.baidu.disconf.core.common.utils.http.HttpClientUtil[66] - response header: Server    Apache-Coyote/1.1
.13:56:29.486 INFO [main] com.baidu.disconf.core.common.utils.http.HttpClientUtil[81] - execute http request [null], status code [200]
.13:56:29.486 DEBUG [main] org.apache.http.impl.conn.PoolingHttpClientConnectionManager[314] - Connection [id: 0][route: {}->http://10.10.39.105:8081] can be kept alive for 5.0 seconds
.13:56:29.486 DEBUG [main] org.apache.http.impl.conn.PoolingHttpClientConnectionManager[320] - Connection released: [id: 0][route: {}->http://10.10.39.105:8081][total kept alive: 1; route allocated: 1 of 2; total allocated: 1 of 20]
.13:56:29.486 DEBUG [main] com.baidu.disconf.client.fetcher.impl.FetcherMgrImpl[77] - remote server return: ValueVo [status=1, message=, value=/disconf]
log4j:WARN No appenders could be found for logger (org.apache.zookeeper.ZooKeeper).
log4j:WARN Please initialize the log4j system properly.
.13:56:32.512 INFO [main] com.baidu.disconf.core.common.zookeeper.inner.ConnectionWatcher[63] - zookeeper: 10.10.39.105:2181 , connected.
.13:56:32.513 INFO [main] com.baidu.disconf.core.common.zookeeper.ZookeeperMgr[100] - zoo prefix: /disconf
.13:56:38.571 INFO [main-EventThread] com.baidu.disconf.core.common.zookeeper.inner.ConnectionWatcher[73] - zk SyncConnected
.13:56:38.575 DEBUG [main] com.baidu.disconf.core.common.zookeeper.ZookeeperMgr[46] - ZookeeperMgr init.
.13:56:38.593 DEBUG [main] com.baidu.disconf.client.core.processor.impl.DisconfFileCoreProcessorImpl[70] - ==============   start to process disconf file: redis.properties =============================
.13:56:38.593 DEBUG [main] com.baidu.disconf.core.common.restful.type.FetchConfFile[51] - start to download. From: http://10.10.39.105:8081/api/config/file?app=test&env=local&type=0&version=0.0.1&key=redis.properties , TO: D:\wuhaoWorkSpace\Mygithub\mouse-disconf\.\disconf\download\redis.properties-f5b8abcd3838440bb972df55d3cdaede
.13:56:38.630 DEBUG [main] com.baidu.disconf.core.common.restful.type.FetchConfFile[62] - download success!  D:\wuhaoWorkSpace\Mygithub\mouse-disconf\.\disconf\download\redis.properties-f5b8abcd3838440bb972df55d3cdaede
.13:56:38.633 DEBUG [main] com.baidu.disconf.core.common.utils.OsUtil[179] - start to replace D:\wuhaoWorkSpace\Mygithub\mouse-disconf\.\disconf\download\redis.properties-f5b8abcd3838440bb972df55d3cdaede to D:\wuhaoWorkSpace\Mygithub\mouse-disconf\.\disconf\download\redis.properties
.13:56:38.637 DEBUG [main] com.baidu.disconf.core.common.utils.OsUtil[179] - start to replace D:\wuhaoWorkSpace\Mygithub\mouse-disconf\.\disconf\download\redis.properties-f5b8abcd3838440bb972df55d3cdaede to D:\wuhaoWorkSpace\Mygithub\mouse-disconf\target\classes\redis.properties
.13:56:38.640 DEBUG [main] com.baidu.disconf.core.common.restful.impl.RestfulMgrImpl[122] - Move to: D:\wuhaoWorkSpace\Mygithub\mouse-disconf\target\classes\redis.properties
.13:56:38.640 DEBUG [main] com.baidu.disconf.client.core.processor.impl.DisconfFileCoreProcessorImpl[119] - download ok.
.13:56:38.642 DEBUG [main] com.baidu.disconf.client.core.filetype.FileTypeProcessorUtils[62] - port 6379
.13:56:38.642 DEBUG [main] com.baidu.disconf.client.core.filetype.FileTypeProcessorUtils[62] - host 127.0.0.1
.13:56:38.642 DEBUG [main] com.baidu.disconf.client.core.processor.impl.DisconfFileCoreProcessorImpl[133] - inject ok.
.13:56:38.672 DEBUG [main] com.baidu.disconf.client.watch.inner.NodeWatcher[69] - monitor path: (/disconf/test_0.0.1_local/file/redis.properties,redis.properties,配置文件) has been added!
.13:56:38.672 DEBUG [main] com.baidu.disconf.client.core.processor.impl.DisconfFileCoreProcessorImpl[146] - watch ok.
.13:56:38.672 INFO [main] com.baidu.disconf.client.DisconfMgr[102] - ******************************* DISCONF END FIRST SCAN *******************************
.13:56:38.673 DEBUG [main] org.springframework.beans.factory.support.DefaultListableBeanFactory[221] - Creating shared instance of singleton bean 'propertyConfigurer'
.13:56:38.673 DEBUG [main] org.springframework.beans.factory.support.DefaultListableBeanFactory[448] - Creating instance of bean 'propertyConfigurer'
.13:56:38.675 DEBUG [main] org.springframework.beans.factory.support.DefaultListableBeanFactory[529] - Eagerly caching bean 'propertyConfigurer' to allow for resolving potential circular references
.13:56:38.710 DEBUG [main] org.springframework.beans.factory.support.DefaultListableBeanFactory[221] - Creating shared instance of singleton bean 'configproperties_disconf'
.13:56:38.710 DEBUG [main] org.springframework.beans.factory.support.DefaultListableBeanFactory[448] - Creating instance of bean 'configproperties_disconf'
.13:56:38.710 DEBUG [main] org.springframework.beans.factory.support.DefaultListableBeanFactory[529] - Eagerly caching bean 'configproperties_disconf' to allow for resolving potential circular references
.13:56:38.710 WARN [main] org.springframework.beans.GenericTypeAwarePropertyDescriptor[135] - Invalid JavaBean property 'locations' being accessed! Ambiguous write methods found next to actually used [public void com.baidu.disconf.client.addons.properties.ReloadablePropertiesFactoryBean.setLocations(java.util.List)]: [public void org.springframework.core.io.support.PropertiesLoaderSupport.setLocations(org.springframework.core.io.Resource[])]
.13:56:38.710 DEBUG [main] com.baidu.disconf.client.core.processor.impl.DisconfFileCoreProcessorImpl[70] - ==============   start to process disconf file: autoconfig.properties    =============================
.13:56:38.710 DEBUG [main] com.baidu.disconf.core.common.restful.type.FetchConfFile[51] - start to download. From: http://10.10.39.105:8081/api/config/file?app=test&env=local&type=0&version=0.0.1&key=autoconfig.properties , TO: D:\wuhaoWorkSpace\Mygithub\mouse-disconf\.\disconf\download\autoconfig.properties-ad23adcbf6da46f1bc37f7c7a5701700
.13:56:38.711 DEBUG [main] com.baidu.disconf.core.common.restful.type.FetchConfFile[62] - download success!  D:\wuhaoWorkSpace\Mygithub\mouse-disconf\.\disconf\download\autoconfig.properties-ad23adcbf6da46f1bc37f7c7a5701700
.13:56:38.711 DEBUG [main] com.baidu.disconf.core.common.restful.impl.RestfulMgrImpl[122] - Move to: D:\wuhaoWorkSpace\Mygithub\mouse-disconf\target\classes\autoconfig.properties
.13:56:38.711 DEBUG [main] com.baidu.disconf.client.core.processor.impl.DisconfFileCoreProcessorImpl[119] - download ok.
.13:56:38.711 DEBUG [main] com.baidu.disconf.client.core.filetype.FileTypeProcessorUtils[62] - cc   03343444456
.13:56:38.711 DEBUG [main] com.baidu.disconf.client.core.filetype.FileTypeProcessorUtils[62] - auto 你好哇 bbd
.13:56:38.711 DEBUG [main] com.baidu.disconf.client.core.processor.impl.DisconfFileCoreProcessorImpl[133] - inject ok.
.13:56:38.715 DEBUG [main] com.baidu.disconf.client.watch.inner.NodeWatcher[69] - monitor path: (/disconf/test_0.0.1_local/file/autoconfig.properties,autoconfig.properties,配置文件) has been added!
.13:56:38.715 DEBUG [main] com.baidu.disconf.client.core.processor.impl.DisconfFileCoreProcessorImpl[146] - watch ok.
.13:56:38.715 DEBUG [main] com.baidu.disconf.client.DisconfMgr[193] - disconf reloadable file: autoconfig.properties
.13:56:38.716 ERROR [main] com.baidu.disconf.client.store.inner.DisconfCenterStore[69] - There are two same fileName!!!! first: 
    DisconfCenterFile [
    keyMaps={port=FileItemValue{value=6379, field=private java.lang.String com.mouse.moon.disconf.SimpleConfig.port, setMethod=null}, host=FileItemValue{value=127.0.0.1, field=private java.lang.String com.mouse.moon.disconf.SimpleConfig.host, setMethod=null}}
    cls=class com.mouse.moon.disconf.SimpleConfig
    fileName=redis.properties
    copy2TargetDirPath=
    DisconfCenterBaseModel [
    object=null
    remoteServerUrl=/api/config/file?app=test&env=local&type=0&version=0.0.1&key=redis.properties
    disConfCommonModel=DisConfCommonModel [app=test, version=0.0.1, env=local]
    disconfCommonCallbackModel=DisconfCommonCallbackModel [disconfConfUpdates=[], disconfUpdatesActiveBackups=[]]]], Second: 
    DisconfCenterFile [
    keyMaps={}
    cls=null
    fileName=redis.properties
    copy2TargetDirPath=null
    DisconfCenterBaseModel [
    object=null
    remoteServerUrl=/api/config/file?app=test&env=local&type=0&version=0.0.1&key=redis.properties
    disConfCommonModel=DisConfCommonModel [app=test, version=0.0.1, env=local]
    disconfCommonCallbackModel=DisconfCommonCallbackModel [disconfConfUpdates=[], disconfUpdatesActiveBackups=[]]]]
.13:56:38.717 DEBUG [main] com.baidu.disconf.client.core.processor.impl.DisconfFileCoreProcessorImpl[70] - ==============   start to process disconf file: redis.properties =============================
.13:56:38.717 DEBUG [main] com.baidu.disconf.core.common.restful.type.FetchConfFile[51] - start to download. From: http://10.10.39.105:8081/api/config/file?app=test&env=local&type=0&version=0.0.1&key=redis.properties , TO: D:\wuhaoWorkSpace\Mygithub\mouse-disconf\.\disconf\download\redis.properties-8e14c87f3f9041e0b883e42cd27ea13c
.13:56:38.724 DEBUG [main] com.baidu.disconf.core.common.restful.type.FetchConfFile[62] - download success!  D:\wuhaoWorkSpace\Mygithub\mouse-disconf\.\disconf\download\redis.properties-8e14c87f3f9041e0b883e42cd27ea13c
.13:56:38.727 DEBUG [main] com.baidu.disconf.core.common.restful.impl.RestfulMgrImpl[122] - Move to: D:\wuhaoWorkSpace\Mygithub\mouse-disconf\target\classes\redis.properties
.13:56:38.727 DEBUG [main] com.baidu.disconf.client.core.processor.impl.DisconfFileCoreProcessorImpl[119] - download ok.
.13:56:38.728 DEBUG [main] com.baidu.disconf.client.core.filetype.FileTypeProcessorUtils[62] - port 6379
.13:56:38.728 DEBUG [main] com.baidu.disconf.client.core.filetype.FileTypeProcessorUtils[62] - host 127.0.0.1
.13:56:38.728 DEBUG [main] com.baidu.disconf.client.core.processor.impl.DisconfFileCoreProcessorImpl[133] - inject ok.
.13:56:38.743 DEBUG [main] com.baidu.disconf.client.watch.inner.NodeWatcher[69] - monitor path: (/disconf/test_0.0.1_local/file/redis.properties,redis.properties,配置文件) has been added!
.13:56:38.743 DEBUG [main] com.baidu.disconf.client.core.processor.impl.DisconfFileCoreProcessorImpl[146] - watch ok.
.13:56:38.743 DEBUG [main] com.baidu.disconf.client.DisconfMgr[193] - disconf reloadable file: redis.properties
.13:56:38.743 DEBUG [main] org.springframework.beans.factory.support.DefaultListableBeanFactory[1620] - Invoking afterPropertiesSet() on bean with name 'configproperties_disconf'
.13:56:38.744 INFO [main] com.baidu.disconf.client.addons.properties.ReloadablePropertiesFactoryBean[172] - Loading properties file from class path resource [autoconfig.properties]
.13:56:38.744 INFO [main] com.baidu.disconf.client.addons.properties.ReloadablePropertiesFactoryBean[172] - Loading properties file from class path resource [redis.properties]
.13:56:38.745 DEBUG [main] org.springframework.beans.factory.support.DefaultListableBeanFactory[484] - Finished creating instance of bean 'configproperties_disconf'
.13:56:38.746 DEBUG [main] org.springframework.beans.factory.support.DefaultListableBeanFactory[1620] - Invoking afterPropertiesSet() on bean with name 'propertyConfigurer'
.13:56:38.746 DEBUG [main] com.baidu.disconf.client.addons.properties.ReloadingPropertyPlaceholderConfigurer[400] - add property listener: {port=6379, host=127.0.0.1, cc=03343444456, auto=你好哇 bbd}
.13:56:38.746 DEBUG [main] org.springframework.beans.factory.support.DefaultListableBeanFactory[484] - Finished creating instance of bean 'propertyConfigurer'
.13:56:38.748 DEBUG [main] org.springframework.beans.factory.support.DefaultListableBeanFactory[221] - Creating shared instance of singleton bean 'org.springframework.aop.config.internalAutoProxyCreator'
.13:56:38.748 DEBUG [main] org.springframework.beans.factory.support.DefaultListableBeanFactory[448] - Creating instance of bean 'org.springframework.aop.config.internalAutoProxyCreator'
.13:56:38.758 DEBUG [main] org.springframework.beans.factory.support.DefaultListableBeanFactory[529] - Eagerly caching bean 'org.springframework.aop.config.internalAutoProxyCreator' to allow for resolving potential circular references
.13:56:38.764 DEBUG [main] org.springframework.beans.factory.support.DefaultListableBeanFactory[484] - Finished creating instance of bean 'org.springframework.aop.config.internalAutoProxyCreator'
.13:56:38.766 DEBUG [main] org.springframework.context.support.ClassPathXmlApplicationContext[717] - Unable to locate MessageSource with name 'messageSource': using default [org.springframework.context.support.DelegatingMessageSource@58594a11]
.13:56:38.768 DEBUG [main] org.springframework.context.support.ClassPathXmlApplicationContext[741] - Unable to locate ApplicationEventMulticaster with name 'applicationEventMulticaster': using default [org.springframework.context.event.SimpleApplicationEventMulticaster@7cb502c]
.13:56:38.769 DEBUG [main] org.springframework.beans.factory.support.DefaultListableBeanFactory[741] - Pre-instantiating singletons in org.springframework.beans.factory.support.DefaultListableBeanFactory@71d15f18: defining beans [org.springframework.aop.config.internalAutoProxyCreator,disconfMgrBean,disconfMgrBean2,configproperties_disconf,propertyConfigurer,simpleConfig,disconfAspectJ]; root of factory hierarchy
.13:56:38.769 DEBUG [main] org.springframework.beans.factory.support.DefaultListableBeanFactory[251] - Returning cached instance of singleton bean 'org.springframework.aop.config.internalAutoProxyCreator'
.13:56:38.769 DEBUG [main] org.springframework.beans.factory.support.DefaultListableBeanFactory[251] - Returning cached instance of singleton bean 'disconfMgrBean'
.13:56:38.769 DEBUG [main] org.springframework.beans.factory.support.DefaultListableBeanFactory[221] - Creating shared instance of singleton bean 'disconfMgrBean2'
.13:56:38.769 DEBUG [main] org.springframework.beans.factory.support.DefaultListableBeanFactory[448] - Creating instance of bean 'disconfMgrBean2'
.13:56:38.809 DEBUG [main] org.springframework.aop.aspectj.annotation.ReflectiveAspectJAdvisorFactory[221] - Found AspectJ method: public java.lang.Object com.baidu.disconf.client.store.aspect.DisconfAspectJ.decideAccess(org.aspectj.lang.ProceedingJoinPoint,com.baidu.disconf.client.common.annotations.DisconfItem) throws java.lang.Throwable
.13:56:38.809 DEBUG [main] org.springframework.aop.aspectj.annotation.ReflectiveAspectJAdvisorFactory[221] - Found AspectJ method: public java.lang.Object com.baidu.disconf.client.store.aspect.DisconfAspectJ.decideAccess(org.aspectj.lang.ProceedingJoinPoint,com.baidu.disconf.client.common.annotations.DisconfFileItem) throws java.lang.Throwable
.13:56:38.812 DEBUG [main] org.springframework.beans.factory.support.DefaultListableBeanFactory[529] - Eagerly caching bean 'disconfMgrBean2' to allow for resolving potential circular references
.13:56:38.813 DEBUG [main] org.springframework.beans.factory.support.DefaultListableBeanFactory[1678] - Invoking init method  'init' on bean with name 'disconfMgrBean2'
.13:56:38.814 INFO [main] com.baidu.disconf.client.DisconfMgr[127] - ******************************* DISCONF START SECOND SCAN *******************************
.13:56:38.815 DEBUG [main] com.baidu.disconf.client.core.processor.impl.DisconfFileCoreProcessorImpl[228] - ==============  start to inject value to disconf file item instance: autoconfig.properties  =============================
.13:56:38.815 DEBUG [main] com.baidu.disconf.client.core.processor.impl.DisconfFileCoreProcessorImpl[228] - ==============  start to inject value to disconf file item instance: redis.properties   =============================
.13:56:38.815 DEBUG [main] org.springframework.beans.factory.support.DefaultListableBeanFactory[221] - Creating shared instance of singleton bean 'simpleConfig'
.13:56:38.815 DEBUG [main] org.springframework.beans.factory.support.DefaultListableBeanFactory[448] - Creating instance of bean 'simpleConfig'
.13:56:38.816 DEBUG [main] org.springframework.beans.factory.support.DefaultListableBeanFactory[529] - Eagerly caching bean 'simpleConfig' to allow for resolving potential circular references
.13:56:39.032 DEBUG [main] org.springframework.aop.aspectj.annotation.AnnotationAwareAspectJAutoProxyCreator[526] - Creating implicit proxy for bean 'simpleConfig' with 0 common interceptors and 2 specific interceptors
.13:56:39.032 DEBUG [main] org.springframework.aop.framework.CglibAopProxy[158] - Creating CGLIB proxy: target source is SingletonTargetSource for target object [com.mouse.moon.disconf.SimpleConfig@373ebf74]
.13:56:39.049 DEBUG [main] org.springframework.aop.framework.CglibAopProxy[832] - Unable to apply any optimisations to advised method: public java.lang.String com.mouse.moon.disconf.SimpleConfig.getHost()
.13:56:39.049 DEBUG [main] org.springframework.aop.framework.CglibAopProxy[832] - Unable to apply any optimisations to advised method: public java.lang.String com.mouse.moon.disconf.SimpleConfig.getPort()
.13:56:39.049 DEBUG [main] org.springframework.aop.framework.CglibAopProxy[832] - Unable to apply any optimisations to advised method: public void com.mouse.moon.disconf.SimpleConfig.setHost(java.lang.String)
.13:56:39.049 DEBUG [main] org.springframework.aop.framework.CglibAopProxy[832] - Unable to apply any optimisations to advised method: public void com.mouse.moon.disconf.SimpleConfig.setPort(java.lang.String)
.13:56:39.049 DEBUG [main] org.springframework.aop.framework.CglibAopProxy[783] - Found finalize() method - using NO_OVERRIDE
.13:56:39.065 DEBUG [main] org.springframework.aop.framework.CglibAopProxy[795] - Found 'equals' method: public boolean java.lang.Object.equals(java.lang.Object)
.13:56:39.081 DEBUG [main] org.springframework.aop.framework.CglibAopProxy[832] - Unable to apply any optimisations to advised method: public java.lang.String java.lang.Object.toString()
.13:56:39.081 DEBUG [main] org.springframework.aop.framework.CglibAopProxy[800] - Found 'hashCode' method: public native int java.lang.Object.hashCode()
.13:56:39.081 DEBUG [main] org.springframework.aop.framework.CglibAopProxy[832] - Unable to apply any optimisations to advised method: protected native java.lang.Object java.lang.Object.clone() throws java.lang.CloneNotSupportedException
.13:56:39.081 DEBUG [main] org.springframework.aop.framework.CglibAopProxy[789] - Method is declared on Advised interface: public abstract int org.springframework.aop.framework.Advised.indexOf(org.springframework.aop.Advisor)
.13:56:39.081 DEBUG [main] org.springframework.aop.framework.CglibAopProxy[789] - Method is declared on Advised interface: public abstract int org.springframework.aop.framework.Advised.indexOf(org.aopalliance.aop.Advice)
.13:56:39.081 DEBUG [main] org.springframework.aop.framework.CglibAopProxy[789] - Method is declared on Advised interface: public abstract boolean org.springframework.aop.framework.Advised.isFrozen()
.13:56:39.081 DEBUG [main] org.springframework.aop.framework.CglibAopProxy[789] - Method is declared on Advised interface: public abstract java.lang.Class[] org.springframework.aop.framework.Advised.getProxiedInterfaces()
.13:56:39.081 DEBUG [main] org.springframework.aop.framework.CglibAopProxy[789] - Method is declared on Advised interface: public abstract boolean org.springframework.aop.framework.Advised.isInterfaceProxied(java.lang.Class)
.13:56:39.081 DEBUG [main] org.springframework.aop.framework.CglibAopProxy[789] - Method is declared on Advised interface: public abstract java.lang.String org.springframework.aop.framework.Advised.toProxyConfigString()
.13:56:39.081 DEBUG [main] org.springframework.aop.framework.CglibAopProxy[789] - Method is declared on Advised interface: public abstract org.springframework.aop.TargetSource org.springframework.aop.framework.Advised.getTargetSource()
.13:56:39.081 DEBUG [main] org.springframework.aop.framework.CglibAopProxy[789] - Method is declared on Advised interface: public abstract void org.springframework.aop.framework.Advised.addAdvisor(int,org.springframework.aop.Advisor) throws org.springframework.aop.framework.AopConfigException
.13:56:39.081 DEBUG [main] org.springframework.aop.framework.CglibAopProxy[789] - Method is declared on Advised interface: public abstract void org.springframework.aop.framework.Advised.addAdvisor(org.springframework.aop.Advisor) throws org.springframework.aop.framework.AopConfigException
.13:56:39.081 DEBUG [main] org.springframework.aop.framework.CglibAopProxy[789] - Method is declared on Advised interface: public abstract void org.springframework.aop.framework.Advised.setTargetSource(org.springframework.aop.TargetSource)
.13:56:39.081 DEBUG [main] org.springframework.aop.framework.CglibAopProxy[789] - Method is declared on Advised interface: public abstract void org.springframework.aop.framework.Advised.setPreFiltered(boolean)
.13:56:39.081 DEBUG [main] org.springframework.aop.framework.CglibAopProxy[789] - Method is declared on Advised interface: public abstract void org.springframework.aop.framework.Advised.setExposeProxy(boolean)
.13:56:39.081 DEBUG [main] org.springframework.aop.framework.CglibAopProxy[789] - Method is declared on Advised interface: public abstract boolean org.springframework.aop.framework.Advised.isExposeProxy()
.13:56:39.081 DEBUG [main] org.springframework.aop.framework.CglibAopProxy[789] - Method is declared on Advised interface: public abstract boolean org.springframework.aop.framework.Advised.isProxyTargetClass()
.13:56:39.081 DEBUG [main] org.springframework.aop.framework.CglibAopProxy[789] - Method is declared on Advised interface: public abstract void org.springframework.aop.framework.Advised.addAdvice(org.aopalliance.aop.Advice) throws org.springframework.aop.framework.AopConfigException
.13:56:39.081 DEBUG [main] org.springframework.aop.framework.CglibAopProxy[789] - Method is declared on Advised interface: public abstract void org.springframework.aop.framework.Advised.addAdvice(int,org.aopalliance.aop.Advice) throws org.springframework.aop.framework.AopConfigException
.13:56:39.082 DEBUG [main] org.springframework.aop.framework.CglibAopProxy[789] - Method is declared on Advised interface: public abstract boolean org.springframework.aop.framework.Advised.isPreFiltered()
.13:56:39.082 DEBUG [main] org.springframework.aop.framework.CglibAopProxy[789] - Method is declared on Advised interface: public abstract void org.springframework.aop.framework.Advised.removeAdvisor(int) throws org.springframework.aop.framework.AopConfigException
.13:56:39.082 DEBUG [main] org.springframework.aop.framework.CglibAopProxy[789] - Method is declared on Advised interface: public abstract boolean org.springframework.aop.framework.Advised.removeAdvisor(org.springframework.aop.Advisor)
.13:56:39.082 DEBUG [main] org.springframework.aop.framework.CglibAopProxy[789] - Method is declared on Advised interface: public abstract boolean org.springframework.aop.framework.Advised.replaceAdvisor(org.springframework.aop.Advisor,org.springframework.aop.Advisor) throws org.springframework.aop.framework.AopConfigException
.13:56:39.082 DEBUG [main] org.springframework.aop.framework.CglibAopProxy[789] - Method is declared on Advised interface: public abstract boolean org.springframework.aop.framework.Advised.removeAdvice(org.aopalliance.aop.Advice)
.13:56:39.082 DEBUG [main] org.springframework.aop.framework.CglibAopProxy[789] - Method is declared on Advised interface: public abstract org.springframework.aop.Advisor[] org.springframework.aop.framework.Advised.getAdvisors()
.13:56:39.082 DEBUG [main] org.springframework.aop.framework.CglibAopProxy[789] - Method is declared on Advised interface: public abstract java.lang.Class org.springframework.aop.TargetClassAware.getTargetClass()
.13:56:39.082 DEBUG [main] org.springframework.beans.factory.support.DefaultListableBeanFactory[484] - Finished creating instance of bean 'simpleConfig'
.13:56:39.082 DEBUG [main] com.baidu.disconf.client.store.processor.impl.DisconfStoreFileProcessorImpl[140] - port is a non-static field. 
.13:56:39.082 DEBUG [main] com.baidu.disconf.client.store.processor.impl.DisconfStoreFileProcessorImpl[140] - host is a non-static field. 
.13:56:39.082 INFO [main] com.baidu.disconf.client.DisconfMgr[158] - Conf File Map: 
disconf-file:   autoconfig.properties   
    DisconfCenterFile [
    keyMaps={}
    cls=null
    fileName=autoconfig.properties
    copy2TargetDirPath=null
    DisconfCenterBaseModel [
    object=null
    remoteServerUrl=/api/config/file?app=test&env=local&type=0&version=0.0.1&key=autoconfig.properties
    disConfCommonModel=DisConfCommonModel [app=test, version=0.0.1, env=local]
    disconfCommonCallbackModel=DisconfCommonCallbackModel [disconfConfUpdates=[], disconfUpdatesActiveBackups=[]]]]
disconf-file:   redis.properties    
    DisconfCenterFile [
    keyMaps={port=FileItemValue{value=6379, field=private java.lang.String com.mouse.moon.disconf.SimpleConfig.port, setMethod=null}, host=FileItemValue{value=127.0.0.1, field=private java.lang.String com.mouse.moon.disconf.SimpleConfig.host, setMethod=null}}
    cls=class com.mouse.moon.disconf.SimpleConfig
    fileName=redis.properties
    copy2TargetDirPath=
    DisconfCenterBaseModel [
    object=com.mouse.moon.disconf.SimpleConfig@373ebf74
    remoteServerUrl=/api/config/file?app=test&env=local&type=0&version=0.0.1&key=redis.properties
    disConfCommonModel=DisConfCommonModel [app=test, version=0.0.1, env=local]
    disconfCommonCallbackModel=DisconfCommonCallbackModel [disconfConfUpdates=[], disconfUpdatesActiveBackups=[]]]]

.13:56:39.082 INFO [main] com.baidu.disconf.client.DisconfMgr[161] - Conf Item Map: 

.13:56:39.082 INFO [main] com.baidu.disconf.client.DisconfMgr[164] - ******************************* DISCONF END *******************************
.13:56:39.100 DEBUG [main] org.springframework.beans.factory.support.DefaultListableBeanFactory[484] - Finished creating instance of bean 'disconfMgrBean2'
.13:56:39.100 DEBUG [main] org.springframework.beans.factory.support.DefaultListableBeanFactory[251] - Returning cached instance of singleton bean 'configproperties_disconf'
.13:56:39.100 DEBUG [main] org.springframework.beans.factory.support.DefaultListableBeanFactory[251] - Returning cached instance of singleton bean 'propertyConfigurer'
.13:56:39.100 DEBUG [main] org.springframework.beans.factory.support.DefaultListableBeanFactory[251] - Returning cached instance of singleton bean 'simpleConfig'
.13:56:39.100 DEBUG [main] org.springframework.beans.factory.support.DefaultListableBeanFactory[221] - Creating shared instance of singleton bean 'disconfAspectJ'
.13:56:39.100 DEBUG [main] org.springframework.beans.factory.support.DefaultListableBeanFactory[448] - Creating instance of bean 'disconfAspectJ'
.13:56:39.116 DEBUG [main] org.springframework.beans.factory.support.DefaultListableBeanFactory[529] - Eagerly caching bean 'disconfAspectJ' to allow for resolving potential circular references
.13:56:39.116 DEBUG [main] org.springframework.beans.factory.support.DefaultListableBeanFactory[484] - Finished creating instance of bean 'disconfAspectJ'
.13:56:39.116 DEBUG [main] org.springframework.context.support.ClassPathXmlApplicationContext[768] - Unable to locate LifecycleProcessor with name 'lifecycleProcessor': using default [org.springframework.context.support.DefaultLifecycleProcessor@5286c33a]
.13:56:39.116 DEBUG [main] org.springframework.beans.factory.support.DefaultListableBeanFactory[251] - Returning cached instance of singleton bean 'lifecycleProcessor'
.13:56:39.116 DEBUG [main] org.springframework.core.env.PropertySourcesPropertyResolver[81] - Searching for key 'spring.liveBeansView.mbeanDomain' in [systemProperties]
.13:56:39.116 DEBUG [main] org.springframework.core.env.PropertySourcesPropertyResolver[81] - Searching for key 'spring.liveBeansView.mbeanDomain' in [systemEnvironment]
.13:56:39.116 DEBUG [main] org.springframework.core.env.PropertySourcesPropertyResolver[103] - Could not find key 'spring.liveBeansView.mbeanDomain' in any property source. Returning [null]
.13:56:39.116 DEBUG [main] org.springframework.beans.factory.support.DefaultListableBeanFactory[251] - Returning cached instance of singleton bean 'simpleConfig'
.13:56:39.116 DEBUG [main] org.springframework.beans.factory.support.DefaultListableBeanFactory[251] - Returning cached instance of singleton bean 'disconfAspectJ'
.13:56:39.116 DEBUG [main] com.baidu.disconf.client.store.aspect.DisconfAspectJ[70] - using disconf store value: redis.properties (host , 127.0.0.1)
.13:56:39.116 DEBUG [main] com.baidu.disconf.client.store.aspect.DisconfAspectJ[70] - using disconf store value: redis.properties (port , 6379)
127.0.0.1   ================>   6379
Process finished with exit code 0
```

做了下簡單測試:
如果這里配置了指定文件苫幢,會在編譯執(zhí)行代碼的時候將文件同步到本地
![Paste_Image.png](http://upload-images.jianshu.io/upload_images/1456372-375659623bdb0819.png?imageMogr2/auto-orient/strip%7CimageView2/2/w/1240)

其實在讀指定文件的時候也會讀取下來,我將xml里面的配置注釋垫挨,在執(zhí)行上面的main的時候也會同步下來韩肝。
![Paste_Image.png](http://upload-images.jianshu.io/upload_images/1456372-93430a64725e74b0.png?imageMogr2/auto-orient/strip%7CimageView2/2/w/1240)


在我們指定的目錄也有文件

![Paste_Image.png](http://upload-images.jianshu.io/upload_images/1456372-e0775dbfe6103aa8.png?imageMogr2/auto-orient/strip%7CimageView2/2/w/1240)





###四、熱加載

```
package com.mouse.moon.disconf;

import org.springframework.context.ApplicationContext;
import org.springframework.context.support.ClassPathXmlApplicationContext;

/**
 * Created by Mahone Wu on 2017/3/28.
 */
public class AppMain {
    public static void main(String[] args)throws Exception {
       /* ApplicationContext factory = new ClassPathXmlApplicationContext("classpath:disconf.xml");
        SimpleConfig  redis = (SimpleConfig )factory.getBean("simpleConfig");
        System.out.println(redis.getHost() + "\t================>\t" + redis.getPort());*/

        ClassPathXmlApplicationContext context = new ClassPathXmlApplicationContext(new String[] {"classpath:disconf.xml"});
        context.start();
        SimpleConfig  redis = (SimpleConfig )context.getBean("simpleConfig");
        System.out.println(redis.getHost() + "\t================>\t" + redis.getPort());
        System.in.read(); // 按任意鍵退出
    }
}
```
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
        http://www.springframework.org/schema/aop
        http://www.springframework.org/schema/aop/spring-aop-3.0.xsd">


    <aop:aspectj-autoproxy proxy-target-class="true"/>

    <!-- 使用disconf必須添加以下配置 -->
    <bean id="disconfMgrBean" class="com.baidu.disconf.client.DisconfMgrBean"
          destroy-method="destroy">
        <!-- 一定注意修改這里掃描包的路徑,我就在這里吃虧了-->
        <property name="scanPackage" value="com.mouse.moon.disconf"/>
    </bean>

    <bean id="disconfMgrBean2" class="com.baidu.disconf.client.DisconfMgrBeanSecond"
          init-method="init" destroy-method="destroy">
    </bean>


    <!-- 使用托管方式的disconf配置(無代碼侵入, 配置更改會自動reload)-->
    <bean id="configproperties_disconf"
          class="com.baidu.disconf.client.addons.properties.ReloadablePropertiesFactoryBean">
        <property name="locations">
            <list>
                <!--<value>autoconfig.properties</value>-->
                <value>redis.properties</value>
            </list>
        </property>
    </bean>


    <bean id="propertyConfigurer"
          class="com.baidu.disconf.client.addons.properties.ReloadingPropertyPlaceholderConfigurer">
        <property name="ignoreResourceNotFound" value="true"/>
        <property name="ignoreUnresolvablePlaceholders" value="true"/>
        <property name="propertiesArray">
            <list>
                <ref bean="configproperties_disconf"/>
            </list>
        </property>
    </bean>

    <bean id="simpleConfig" class="com.mouse.moon.disconf.SimpleConfig"/>




<!--下面這是熱部署九榔,修改了配置會自動檢測進行更新操作-->

    <!-- 使用托管方式的disconf配置(無代碼侵入, 配置更改自動reload)-->
    <bean id="configproperties_disconf_reload"
          class="com.baidu.disconf.client.addons.properties.ReloadablePropertiesFactoryBean">
        <property name="locations">
            <list>
                <value>autoconfig.properties</value>
            </list>
        </property>
    </bean>

    <bean id="propertyConfigurer_reload"
          class="com.baidu.disconf.client.addons.properties.ReloadingPropertyPlaceholderConfigurer">
        <property name="ignoreResourceNotFound" value="true" />
        <property name="ignoreUnresolvablePlaceholders" value="true" />
        <property name="propertiesArray">
            <list>
                <ref bean="configproperties_disconf_reload"/>
            </list>
        </property>
    </bean>
</beans>
```

![Paste_Image.png](http://upload-images.jianshu.io/upload_images/1456372-59167cec871a9cd8.png?imageMogr2/auto-orient/strip%7CimageView2/2/w/1240)

我修改了autoconfig.properties文件哀峻,增加了**ee=123**涡相,可以看到idea的console中重新對改文件進行了加載操作
![Paste_Image.png](http://upload-images.jianshu.io/upload_images/1456372-ef749e2b46302587.png?imageMogr2/auto-orient/strip%7CimageView2/2/w/1240)

![Paste_Image.png](http://upload-images.jianshu.io/upload_images/1456372-c95d5e8b56d5529b.png?imageMogr2/auto-orient/strip%7CimageView2/2/w/1240)


![Paste_Image.png](http://upload-images.jianshu.io/upload_images/1456372-ed0a1ac5df00eef8.png?imageMogr2/auto-orient/strip%7CimageView2/2/w/1240)

更改打印日志如下:
```
.14:54:58.417 INFO [main-EventThread] com.baidu.disconf.client.watch.inner.NodeWatcher[86] - ============GOT UPDATE EVENT WatchedEvent state:SyncConnected type:NodeDataChanged path:/disconf/test_0.0.1_local/file/autoconfig.properties: (/disconf/test_0.0.1_local/file/autoconfig.properties,autoconfig.properties,配置文件)======================
.14:54:58.418 DEBUG [main-EventThread] com.baidu.disconf.core.common.restful.type.FetchConfFile[51] - start to download. From: http://10.10.39.105:8081/api/config/file?app=test&env=local&type=0&version=0.0.1&key=autoconfig.properties , TO: D:\wuhaoWorkSpace\Mygithub\mouse-disconf\.\disconf\download\autoconfig.properties-335ef0786b794e2daafd9a25c152bb10
.14:54:58.432 DEBUG [main-EventThread] com.baidu.disconf.core.common.restful.type.FetchConfFile[62] - download success!  D:\wuhaoWorkSpace\Mygithub\mouse-disconf\.\disconf\download\autoconfig.properties-335ef0786b794e2daafd9a25c152bb10
.14:54:58.434 DEBUG [main-EventThread] com.baidu.disconf.core.common.utils.OsUtil[179] - start to replace D:\wuhaoWorkSpace\Mygithub\mouse-disconf\.\disconf\download\autoconfig.properties-335ef0786b794e2daafd9a25c152bb10 to D:\wuhaoWorkSpace\Mygithub\mouse-disconf\.\disconf\download\autoconfig.properties
.14:54:58.443 DEBUG [main-EventThread] com.baidu.disconf.core.common.utils.OsUtil[179] - start to replace D:\wuhaoWorkSpace\Mygithub\mouse-disconf\.\disconf\download\autoconfig.properties-335ef0786b794e2daafd9a25c152bb10 to D:\wuhaoWorkSpace\Mygithub\mouse-disconf\target\classes\autoconfig.properties
.14:54:58.449 DEBUG [main-EventThread] com.baidu.disconf.core.common.restful.impl.RestfulMgrImpl[122] - Move to: D:\wuhaoWorkSpace\Mygithub\mouse-disconf\target\classes\autoconfig.properties
.14:54:58.449 DEBUG [main-EventThread] com.baidu.disconf.client.core.processor.impl.DisconfFileCoreProcessorImpl[119] - download ok.
.14:54:58.450 DEBUG [main-EventThread] com.baidu.disconf.client.core.filetype.FileTypeProcessorUtils[62] - dd   123
.14:54:58.450 DEBUG [main-EventThread] com.baidu.disconf.client.core.filetype.FileTypeProcessorUtils[62] - ee   123
.14:54:58.450 DEBUG [main-EventThread] com.baidu.disconf.client.core.filetype.FileTypeProcessorUtils[62] - cc   03343444456
.14:54:58.450 DEBUG [main-EventThread] com.baidu.disconf.client.core.filetype.FileTypeProcessorUtils[62] - auto 你好哇 bbd
.14:54:58.450 INFO [main-EventThread] com.baidu.disconf.client.addons.properties.ReloadablePropertiesFactoryBean[172] - Loading properties file from class path resource [autoconfig.properties]
.14:54:58.451 DEBUG [main-EventThread] com.baidu.disconf.client.core.processor.impl.DisconfFileCoreProcessorImpl[133] - inject ok.
.14:54:58.471 DEBUG [main-EventThread] com.baidu.disconf.client.watch.inner.NodeWatcher[69] - monitor path: (/disconf/test_0.0.1_local/file/autoconfig.properties,autoconfig.properties,配置文件) has been added!
.14:54:58.471 DEBUG [main-EventThread] com.baidu.disconf.client.core.processor.impl.DisconfFileCoreProcessorImpl[146] - watch ok.
```

代碼在github上https://github.com/MahoneWu/disconfTest.git
最后編輯于
?著作權歸作者所有,轉載或內容合作請聯系作者
  • 序言:七十年代末,一起剝皮案震驚了整個濱河市剩蟀,隨后出現的幾起案子催蝗,更是在濱河造成了極大的恐慌,老刑警劉巖育特,帶你破解...
    沈念sama閱讀 222,378評論 6 516
  • 序言:濱河連續(xù)發(fā)生了三起死亡事件丙号,死亡現場離奇詭異,居然都是意外死亡缰冤,警方通過查閱死者的電腦和手機犬缨,發(fā)現死者居然都...
    沈念sama閱讀 94,970評論 3 399
  • 文/潘曉璐 我一進店門,熙熙樓的掌柜王于貴愁眉苦臉地迎上來棉浸,“玉大人遍尺,你說我怎么就攤上這事′剔郑” “怎么了乾戏?”我有些...
    開封第一講書人閱讀 168,983評論 0 362
  • 文/不壞的土叔 我叫張陵,是天一觀的道長三热。 經常有香客問我鼓择,道長,這世上最難降的妖魔是什么就漾? 我笑而不...
    開封第一講書人閱讀 59,938評論 1 299
  • 正文 為了忘掉前任呐能,我火速辦了婚禮,結果婚禮上抑堡,老公的妹妹穿的比我還像新娘摆出。我一直安慰自己,他們只是感情好首妖,可當我...
    茶點故事閱讀 68,955評論 6 398
  • 文/花漫 我一把揭開白布偎漫。 她就那樣靜靜地躺著,像睡著了一般有缆。 火紅的嫁衣襯著肌膚如雪象踊。 梳的紋絲不亂的頭發(fā)上,一...
    開封第一講書人閱讀 52,549評論 1 312
  • 那天棚壁,我揣著相機與錄音杯矩,去河邊找鬼。 笑死袖外,一個胖子當著我的面吹牛史隆,可吹牛的內容都是我干的。 我是一名探鬼主播曼验,決...
    沈念sama閱讀 41,063評論 3 422
  • 文/蒼蘭香墨 我猛地睜開眼泌射,長吁一口氣:“原來是場噩夢啊……” “哼头镊!你這毒婦竟也來了?” 一聲冷哼從身側響起魄幕,我...
    開封第一講書人閱讀 39,991評論 0 277
  • 序言:老撾萬榮一對情侶失蹤相艇,失蹤者是張志新(化名)和其女友劉穎,沒想到半個月后纯陨,有當地人在樹林里發(fā)現了一具尸體坛芽,經...
    沈念sama閱讀 46,522評論 1 319
  • 正文 獨居荒郊野嶺守林人離奇死亡,尸身上長有42處帶血的膿包…… 初始之章·張勛 以下內容為張勛視角 年9月15日...
    茶點故事閱讀 38,604評論 3 342
  • 正文 我和宋清朗相戀三年翼抠,在試婚紗的時候發(fā)現自己被綠了咙轩。 大學時的朋友給我發(fā)了我未婚夫和他白月光在一起吃飯的照片。...
    茶點故事閱讀 40,742評論 1 353
  • 序言:一個原本活蹦亂跳的男人離奇死亡阴颖,死狀恐怖活喊,靈堂內的尸體忽然破棺而出,到底是詐尸還是另有隱情量愧,我是刑警寧澤钾菊,帶...
    沈念sama閱讀 36,413評論 5 351
  • 正文 年R本政府宣布,位于F島的核電站偎肃,受9級特大地震影響煞烫,放射性物質發(fā)生泄漏。R本人自食惡果不足惜累颂,卻給世界環(huán)境...
    茶點故事閱讀 42,094評論 3 335
  • 文/蒙蒙 一滞详、第九天 我趴在偏房一處隱蔽的房頂上張望。 院中可真熱鬧紊馏,春花似錦料饥、人聲如沸。這莊子的主人今日做“春日...
    開封第一講書人閱讀 32,572評論 0 25
  • 文/蒼蘭香墨 我抬頭看了看天上的太陽。三九已至赌朋,卻和暖如春凰狞,著一層夾襖步出監(jiān)牢的瞬間篇裁,已是汗流浹背沛慢。 一陣腳步聲響...
    開封第一講書人閱讀 33,671評論 1 274
  • 我被黑心中介騙來泰國打工, 沒想到剛下飛機就差點兒被人妖公主榨干…… 1. 我叫王不留达布,地道東北人团甲。 一個月前我還...
    沈念sama閱讀 49,159評論 3 378
  • 正文 我出身青樓,卻偏偏與公主長得像黍聂,于是被迫代替她去往敵國和親躺苦。 傳聞我的和親對象是個殘疾皇子身腻,可洞房花燭夜當晚...
    茶點故事閱讀 45,747評論 2 361

推薦閱讀更多精彩內容