开发者

Instantiate XMLConfiguration from spring

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 ?


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.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜