Spring 2.0 XML PropertyPlaceholderConfigurer System.getProperty(" user.dir")

时间:2018-01-09 12:16:25

标签: java xml spring properties system

我目前正在尝试编写一个XML文件,该文件使用" System.getProperty(" user.dir")"的路径。我正在使用Spring 2.0并且有以下代码,我想编辑它以便我可以以某种方式调用user.dir路径,这个例子应该只显示我想用XML文件做什么,当然它不能像这样工作:

<bean class="org.springframework.beans.factory.config.PropertyPlaceholderConfigurer">
        <property name="locations">
            <list>
            <value>file:System.getProperty("user.dir")/PATH...</value>  
            <value>file:System.getProperty("user.dir")/PATH...</value>
            </list>
        </property>             
   </bean>

1 个答案:

答案 0 :(得分:0)

好的,我只是通过结合其他网站的不同方法找到答案:

<bean class="org.springframework.beans.factory.config.PropertyPlaceholderConfigurer">
    <property name="locations">
        <list>
        <value>file:${user.dir}/PATH...</value>  
        <value>file:${user.dir}/PATH...</value>
        </list>
    </property>             

相关问题