GET BEAN OUT OF SPRING CONFIG FILE
//define location of the config files referenced by the bean(s)
ClassPathXmlApplicationContext springContext = new ClassPathXmlApplicationContext(
new String[]{"classpath*:config1.xml",
"classpath*:/subdir/config2.xml",
"classpath*:etc.xml"});
//get the bean
MyBean myBean = (MyBean)springContext.getBean("myBeanName");
Subscribe to:
Post Comments (Atom)
No comments:
Post a Comment