开发者

Specifying Locations relative to the context XML in Spring

开发者 https://www.devze.com 2022-12-26 03:13 出处:网络
Is there a way to reference a properties file on a file system (not on a 开发者_如何学Pythonclasspath) relative to the Spring\'s context file itself?

Is there a way to reference a properties file on a file system (not on a 开发者_如何学Pythonclasspath) relative to the Spring's context file itself?

What I want to do is the below:

<bean class="org.springframework.beans.factory.config.PropertyPlaceholderConfigurer">
    <property name="locations">
        <list>
            <!-- I want the below to be relative to this context XML file. -->
            <value>app.properties</value>
        </list>
    </property>
</bean>

I was imagining something like ${contextpath} that I could prepend to the above "app.properties" but couldn't find anything helpful.

Thanks.


You can reference properties on the classpath via the classpath: prefix:

<value>classpath:app.properties</value>
0

精彩评论

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

关注公众号