PropertyPlaceholderConfigurer reads from XML File (Apache Commons Configuration)?

Here is a solution using spring modules I don't know how current this is, but even if it isn't you could probably easily take the code and make it work with current versions.

Here is a solution using spring modules. I don't know how current this is, but even if it isn't you could probably easily take the code and make it work with current versions.

I found a solution with the help of seanizer and springmodule class TestConfiguration public class TestConfiguration { private String domain; public String getDomain() { return domain; } public void setDomain(String domain) { this. Domain = domain; } } jUnit Testclass @RunWith(SpringJUnit4ClassRunner. Class) @ContextConfiguration( { "/applicationContextTest.

Xml" }) public class ApacheCommonCfg2Spring extends AbstractJUnit4SpringContextTests { private TestConfiguration tcfg; @Test public void configuration(){ tcfg = this. ApplicationContext. GetBean("testConfig", TestConfiguration.

Class); System.out. Println(tcfg.getDomain()); } } Springmodule is rather old an it seems that it is not longer maintained, but it works with Spring 3.0.3. Feel free to copy & paste!

The easiest way (maybe not the nicest though) would be to subclass the PropertyPlaceholdeConfigurer, load the commons configuration there and then pass it to the superclass: public class TestPlaceholderConfigurer extends PropertyPlaceholderConfigurer { public TestPlaceholderConfigurer() { super(); } @Override protected void processProperties(ConfigurableListableBeanFactory beanFactoryToProcess, Properties props) throws BeansException { XMLConfiguration config = new XMLConfiguration("config. Xml"); Properties commonsProperties = config. GetProperties("someKey") // Or something else with the configuration super.

ProcessProperties(beanFactoryToProcess, commonsProperties); } } Then you just use this class as the placeholderConfig.

It dosen't work. – Alex Jul 2 '10 at 9:12 1 Maybe you can elaborate on "It dosen't work". After all, Daff has put some effort in trying to answer your question.

– Sean Patrick Floyd Jul 2 '10 at 12:15 That's true, it wasn't supposed to be a copy & paste answer (which is what I have to assume you did regarding your unhelpful reply and an uncommented downvote). As usual with answers here it is just a guide on how to solve your problem, if you have a specific question just post it as a reply. – Daff Jul 3 '10 at 2:18 1 I apologize for my nasty comment, you brought my on the right way!

– Alex Jul 3 '10 at 8:10.

I cant really gove you an answer,but what I can give you is a way to a solution, that is you have to find the anglde that you relate to or peaks your interest. A good paper is one that people get drawn into because it reaches them ln some way.As for me WW11 to me, I think of the holocaust and the effect it had on the survivors, their families and those who stood by and did nothing until it was too late.

Related Questions