美文网首页
spring结合disconf的使用说明

spring结合disconf的使用说明

作者: 吴世浩 | 来源:发表于2017-03-29 14:57 被阅读11741次

    一、浩言

    林中有鹿,鹿有孤独,头上有角,心中有梦

    二、背景

    昨天配置完,晚上就加班测试spring连接问题,可是我测试到八点半,我还是没有获取到配置文件数据,然后就下班路上思考了下,今天早上来,又重新看了下配置,才发现是自己没有修改扫描的包位置,造成之前每次都是没找到指定的配置文件。

    三、配置

    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
    ```
    
    做了下简单测试:
    如果这里配置了指定文件,会在编译执行代码的时候将文件同步到本地
    ![Paste_Image.png](https://img.haomeiwen.com/i1456372/375659623bdb0819.png?imageMogr2/auto-orient/strip%7CimageView2/2/w/1240)
    
    其实在读指定文件的时候也会读取下来,我将xml里面的配置注释,在执行上面的main的时候也会同步下来。
    ![Paste_Image.png](https://img.haomeiwen.com/i1456372/93430a64725e74b0.png?imageMogr2/auto-orient/strip%7CimageView2/2/w/1240)
    
    
    在我们指定的目录也有文件
    
    ![Paste_Image.png](https://img.haomeiwen.com/i1456372/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](https://img.haomeiwen.com/i1456372/59167cec871a9cd8.png?imageMogr2/auto-orient/strip%7CimageView2/2/w/1240)
    
    我修改了autoconfig.properties文件,增加了**ee=123**,可以看到idea的console中重新对改文件进行了加载操作
    ![Paste_Image.png](https://img.haomeiwen.com/i1456372/ef749e2b46302587.png?imageMogr2/auto-orient/strip%7CimageView2/2/w/1240)
    
    ![Paste_Image.png](https://img.haomeiwen.com/i1456372/c95d5e8b56d5529b.png?imageMogr2/auto-orient/strip%7CimageView2/2/w/1240)
    
    
    ![Paste_Image.png](https://img.haomeiwen.com/i1456372/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

    相关文章

      网友评论

          本文标题:spring结合disconf的使用说明

          本文链接:https://www.haomeiwen.com/subject/svjeottx.html