私は次のことをしようとしています: - JNDI env-entry 'country' を値 'us' で構成します - Spring を取得して env-entry 'country' を読み取ります - Spring EL で使用して構成ファイルをロードします
したがって、私の applicationContext は次のようになります。
<bean class="org.springframework.context.support.PropertySourcesPlaceholderConfigurer">
<property name="locations">
<list>
<value>classpath*:application-${country}.properties</value>
</list>
</property>
</bean>
問題: JNDI から ${country} に値 'java:comp/env/country' を取得するにはどうすればよいですか?
これは機能しません:
<jee:jndi-lookup id="country" jndi-name="java:comp/env/country"/>
*編集*
追加<context:property-placeholder/>
しましたが、ログにはJNDI名が見つかったことが示されていますが、それでも使用を拒否しています。ログ:
PropertySourcesPropertyResolver | Searching for key 'country' in [jndiProperties]
JndiTemplate | Looking up JNDI object with name [java:comp/env/country]
JndiLocatorDelegate | Located object with JNDI name [java:comp/env/country]
JndiPropertySource | JNDI lookup for name [country] returned: [us]
PropertySourcesPropertyResolver | Found key 'country' in [jndiProperties] with type [String] and value 'us'
...
Could not resolve placeholder 'country' in string value "classpath*:application-${country}.properties
これは本当にイライラします...