spring中使用字符串注入collection,如set/array

spring中使用字符串注入collection,如set
xxxx.properties里面配置

setstr=10.25.33.188:26379,10.25.27.13:26379

在xml中配置:

<bean id="setInConstruct" class="common.spring.ioc.set.SetInConstruct">
        <constructor-arg index="0" value="#{'${setstr}'.split(',')}"/>
        <constructor-arg index="1" value="123,456" />
    bean>

注意:spring el需要spring3.0以上版本才能使用

你可能感兴趣的:(JAVA)