I've to set an environment map (to set JMX connector credentials) as a bean property. This map must include a String[2] entry.
Is they're a Spring way to setup a String[] in bean context ?
I've to set an environment map (to set JMX connector credentials) as a bean property. This map must include a String[2] entry.
Is they're a Spring way to setup a String[] in bean context ?
This is not tested, and I think it's rather cumbersome at that. I'm sure there are better ways (like writing your own factory bean), but I can't think of any of them now...
Code:<bean id="arrayList" class="org.springframework.beans.factory.config.ListFactoryBean"> <property name="sourceList"> <list> <value>value 1</value> <value>value 2</value> </list> </property> </bean> <bean id="someBean" class="foo"> <property name="someMap"> <map> <entry> <key><value>theKey</value></key> <bean factory-bean="arrayList" factory-method="toArray"/> </entry> </map> </property> </bean>
--Jing Xue
I had already tested this, but it builds on Object[] array, not String[].
I will have to create a factoryBean for this.
Thanks you for suggestion anyway.
String[] property example:
Code:<property name="pages"><value>page1,page2,page3</value></property>
It works, I just had to add
Thanks.Code:<value type="java.lang.String[]">