-2
web.xmlファイルに外部化するパラメータはほとんどありません。アプリケーションは春4.0です。これを行うには春の方法はありますか?Springアプリケーションのweb.xmlパラメータを外部化
より正確には、私がPropertyPlaceholderConfigurerをコンテキストファイルに定義すると、web.xmlのプロパティを取得するためにPropertyPlaceholderConfigurerを使用する方法はありますか?
これは私が試したものです:applicationContext.xmlをで
:
<bean
class="org.springframework.beans.factory.config.PropertyPlaceholderConfigurer">
<property
name="location"
value="classpath:/test.properties" />
<property
name="ignoreUnresolvablePlaceholders"
value="true" />
</bean>
次にweb.xmlに:
<context-param>
<param-name>contextConfigLocation</param-name>
<param-value>
/WEB-INF/applicationContext.xml
</param-value>
</context-param>
しかし、以下のコードでは、$ {アプリとしてのparam値を返します。 .url}
<init-param>
<param-name>appUrl</param-name>
<param-value>${app.url}</param-value>
</init-param>
みんな、否定的な票を理解していない!!!! – Ani