Warning: file_get_contents(/data/phpspider/zhask/data//catemap/0/jpa/2.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Java Spring EL在applicationContext中可用的JNDI环境条目_Java_Spring_Jndi - Fatal编程技术网

Java Spring EL在applicationContext中可用的JNDI环境条目

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

我正在努力做到以下几点: -配置值为“us”的JNDI环境条目“country” -让Spring读取环境条目“country” -在Spring EL中使用它来加载配置文件

因此,我的应用程序上下文如下所示:

<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