2

Spring のコンテキスト ファイル自体に関連する (クラスパスではなく) ファイル システム上のプロパティ ファイルを参照する方法はありますか?

私がやりたいことは以下です:

<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>

${contextpath}上記の「app.properties」の前に追加できるようなものを想像していましたが、役立つものは何も見つかりませんでした。

ありがとう。

4

1 に答える 1

0

classpath:プレフィックスを使用して、クラスパスのプロパティを参照できます。

<value>classpath:app.properties</value>
于 2010-04-07T09:30:05.020 に答える