以下の構成を使用して、Spring アプリケーションでプロパティ ファイルを読み取ることができます (クラスパスのワイルドカードに注意してください) 。
<bean class="org.springframework.beans.factory.config.PropertyPlaceholderConfigurer">
<property name="locations">
<value>classpath*:*/**/test*.properties</value>
</property>
しかし、同じワイルドカード パターンを使用して、以下のようにorg.springframework.web.util.Log4jConfigListener
inを使用してカスタム Log4j プロパティ ファイルを指定すると、厄介で失敗し、Log4j が初期化されません。web.xml
FileNotFoundException
誰かが問題を解決するのを手伝ってくれて、ここで何が欠けているのかを教えてくれますか?
web.xml
<context-param>
<param-name>log4jConfigLocation</param-name>
<param-value>classpath*:*/**/customLog4j*.properties</param-value>
</context-param>
<listener>
<listener-class>org.springframework.web.util.Log4jConfigListener</listener-class>
</listener>
PS:私は、プロパティ プレース ホルダー、つまりを認識しています。${SOME_PLACE_HOLDER}
(プレースホルダーの値をそれぞれのシステム/環境プロパティに置き換えることができます)このようなシステム/環境プロパティの設定を制御できず、ワイルドカードを使用してカスタムlog4jプロパティへのパスを解決する必要があるため、私の場合は適用できません.