I'm building my project with maven so according to maven way, config should be in src/main/conf
, how can I say to my spring application context that that is where jdbc.properties
is found? Here is example bean :
<bean id="propertyConfigurer" class="or开发者_运维百科g.springframework.beans.factory.config.PropertyPlaceholderConfigurer">
<property name="location" value="jdbc.properties" />
</bean>
Spring assumens that this configuration is inside src/main/webapp/WEB-INF, I hope I've been clear if not I'll rephrase my question thank you
I'm building my project with maven so according to maven way, config should be in src/main/conf
Actually, configuration data should generally go in src/main/resources, that way it will be on the classpath and you can reference your property file like:
<property name="location" value="classpath:jdbc.properties" />
I think it is not quite clear as to what a "config file" means. I am thinking it is the config files used by the other maven plugins (such as surefire plugins, assembly plugins etc).
Surely in the 10+ web app projects that I have worked the bean files, jdbc.properties files have all been under src/main/resources
Try this
<bean id="propertyConfigurer" class="org.springframework.beans.factory.config.PropertyPlaceholderConfigurer">
<property name="location" value="src/main/config/jdbc.properties" />
</bean>
精彩评论