spring 에서 set/array 와 같은 문자열 을 사용 하여 collection 을 주입 합 니 다.

1254 단어 JAVA
spring 에서 set xxxx.properties 와 같은 문자열 을 사용 하여 collection 을 주입 합 니 다.
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 은 spring 3.0 이상 버 전이 있어 야 사용 할 수 있 습 니 다.

좋은 웹페이지 즐겨찾기