Saturday, May 9, 2009

Spring PropertyPlaceholderConfigurer

Here is the code to use PropertyPlaceholderConfigurer with XMLBeanFactory

XmlBeanFactory factory = new XmlBeanFactory(new ClassPathResource("test.xml"));
PropertyPlaceholderConfigurer cfg = new PropertyPlaceholderConfigurer();
cfg.setLocation(new ClassPathResource("jdbc.properties"));
// now actually do the replacement
cfg.postProcessBeanFactory(factory);
MyBean bean = (MyBean)factory.getBean("myBean");
System.out.println(bean .getProperty());

1 comment:

Anonymous said...

It isn't hard at all to start making money online in the hush-hush world of [URL=http://www.www.blackhatmoneymaker.com]blackhat seo techniques[/URL], Don’t feel silly if you haven’t heard of it before. Blackhat marketing uses alternative or not-so-known avenues to build an income online.