File: context.xml
"http://www.springframework.org/dtd/spring-beans.dtd">
File: Main.java
import org.springframework.beans.factory.BeanFactory;
import org.springframework.beans.factory.xml.XmlBeanFactory;
import org.springframework.core.io.ClassPathResource;
public class Main {
public static void main(String[] args) throws Exception {
BeanFactory beanFactory = new XmlBeanFactory(new ClassPathResource("context.xml"));
PropertyEditorTestBean testBean = (PropertyEditorTestBean) beanFactory.getBean("testBean");
System.out.println(testBean.getMyStrings().length);
}
}
class PropertyEditorTestBean {
private String[] myStrings;
public String[] getMyStrings() {
return myStrings;
}
public void setMyStrings(String[] myStrings) {
this.myStrings = myStrings;
}
}
Spring-PropertySettingStringArray.zip( 2,599 k)