Java Spring EL在applicationContext中可用的JNDI环境条目
我正在努力做到以下几点: -配置值为“us”的JNDI环境条目“country” -让Spring读取环境条目“country” -在Spring EL中使用它来加载配置文件 因此,我的应用程序上下文如下所示:Java Spring EL在applicationContext中可用的JNDI环境条目,java,spring,jndi,Java,Spring,Jndi,我正在努力做到以下几点: -配置值为“us”的JNDI环境条目“country” -让Spring读取环境条目“country” -在Spring EL中使用它来加载配置文件 因此,我的应用程序上下文如下所示: <bean class="org.springframework.context.support.PropertySourcesPlaceholderConfigurer"> <property name="locations"> <
<bean class="org.springframework.context.support.PropertySourcesPlaceholderConfigurer">
<property name="locations">
<list>
<value>classpath*:application-${country}.properties</value>
</list>
</property>
</bean>
这真是令人沮丧…我想#{country}可能有用,而不是${country}尝试过,但没有成功,看看日志,我会说它没有查看JNDI,我找不到任何东西显示它找到了“country”(如果我使用${country},它会显示在日志中-见上文)。最终导致长堆栈跟踪org.springframework.beans.factory.BeanCreationException:创建名为的bean时出错。。。
<jee:jndi-lookup id="country" jndi-name="java:comp/env/country"/>
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