Tuesday, October 6, 2009

How to define multiple PropertyPlaceholderConfigurer beans

I came across a problem today regarding the app that I am working on wherein I have to define a different PropertyPlaceholderConfigurer bean for each of my context xml files. (Each context xml file is imported in another xml file so it became a little bit tricky).

What I did was, I defined a PropertyPlaceholderConfigurer bean on the first context xml file and I defined another one on the second, so that each context xml can have it's own distinct PropertyPlaceholderConfigurer bean. But upon doing so, I got the following error

Exception in thread "main" org.springframework.beans.factory.BeanDefinitionStoreException: Invalid bean definition with name 'myClass' defined in class path resource [spring-config.xml]: Could not resolve placeholder 'props.value.2'

After google-ing a bit I found the answer to my problem on an entry on Parth Barot's blog. Please take a look!

1 comment:

  1. Sadly, the page you linked to doesn't exist. Would have been nice to have an actual explanation or at least a summary here instead of a link and a "Please take a look!"