tags:

views:

115

answers:

2

I'm trying to set org.springframework.beans.factory.config.PropertyPlaceholderConfigurer spring bean, I have jdbc.properties in src/main/config .. when I put this file in src/main/resources and put classpath: in value my app deploys successfuly.

This works when jdbc.properties is located in src/main/resources

 <property name="location" value="classpath:jdbc.properties" />

However I'm required to put any configuration inside src/main/config , how do I point springs towards this location in the right way?

+4  A: 

This is a classpath issue, not a Spring issue. Add src/main/config to your classpath and it will work. In Eclipse, this means adding it to the project Build Path->Source.

stevedbrown
+1 for two reasons: Totally a classpath issue. Also, mentioning HOW to do it in an IDE.
aperkins
I added ` <classpathentry kind="src" path="src/main/config" including="**/*.properties"/>` to my .classpath and its still not working
Gandalf StormCrow
Did you restart Eclipse after doing that? That's how it's done, although the including= part isn't required.
stevedbrown
+1  A: 

The right answer to this is given by @matt b ,

"What I am referring to is the fact that when you package the application, the config files are not packaged in a folder named src/main/config in the packaged file (jar/war/etc.). Therefore your answer only works when you run the application within the source code, or when src/main/config is in the classpath (which it is not by default). The correct prefix is to use classpath: or another location."

In this question :

http://stackoverflow.com/questions/2524161/trying-to-setup-externalizing-properties-in-spring/

c0mrade
That does look like another version of hte same question
stevedbrown