Reputation: 15274
I'm trying to instantiate XMLConfiguration from spring appcontext, my configuration file is in
src/main/resources/
But when I try to pass the constructor args like this :
<constructor-arg type="java.lang.String" value="classpath:/config.xml"/>
or
<constructor-arg type="java.lang.String" value="classpath:config.xml"/>
The spring cannot locate the file :
org.apache.commons.configuration.ConfigurationException: Cannot locate configuration source classpath:/config.xml
But I can see it inside the war, in
\WEB-INF\classes
Can anyone think what I'm doing wrong ?
Upvotes: 0
Views: 1066
Reputation: 403441
classpath:/config.xml
is Spring-style, and Commons Config doesn't know what that means. You need to pass a path to XMLConfiguration
that it knows how to interpret. The javadoc link that you posted suggests that XMLConfiguration
requires an actual file path, not a classpath reference.
Upvotes: 2