xml配置中的consul属性

时间:2016-01-27 09:51:59

标签: spring-boot spring-cloud consul

我正在尝试使用consul进行spring应用程序的集中配置。当我像示例1一样使用基于注释的配置时,它可以很好地工作。

//Example 1
@Configuration
@EnableConsulPropertySource({"root/api/defaults", "root/global/defaults"})
public class ApplicationConfiguration {
    @Value("httpclient.pool.maxtotal")
    private int maxTotal;

    @Value("httpclient.pool.defaultmaxperroute")
    private int maxPerRoute;

    ...
} 

但是我找不到直接在xml中使用consul属性的方法。

<bean id="properties" class="org.springframework.SomeBeanToEnableConsulInXMLConfig">
    <property name="locations">
        <list>
            <value>root/api/defaults</value>
            <value>root/global/defaults</value>
        </list>
    </property>
</bean>

...

<bean name="http.client" class="com.xxx.HTTPClient">
    <property name="maxTotal" value="${httpclient.pool.maxtotal}" />
    <property name="defaultMaxPerRoute" value="${httpclient.pool.defaultmaxperroute}" />
</bean>

Spring是否有类似SomeBeanToEnableConsulInXMLConfig或实现此类的任何提示?

0 个答案:

没有答案
相关问题