尝试从applciation连接两个JNDI, 代码
<?xml version="1.0" encoding="UTF-8"?>
<bean id="properties"
class="org.apache.camel.component.properties.PropertiesComponent">
<property name="location" ref="osfCamelPropertyLocation" />
</bean>
<bean id="defaultPropertyFileLocation" class="java.lang.String">
<constructor-arg value="classpath:spring-properties-configure.properties" />
</bean>
<!-- List of property files in defined order, alows multiple config files -->
<util:list id="propertyFileLocations">
<value>#{defaultPropertyFileLocation}</value>
</util:list>
<beans profile="!test">
<jee:jndi-lookup id="osfPropsCamel"
jndi-name="properties/orderFulfillmentServiceCamel" expected-type="java.util.Properties" />
<jee:jndi-lookup id="amqEnvProps" jndi-name="properties/AMQ"
expected-type="java.util.Properties" />
<!-- Allows mixing jndi and file properties in Camel context(s). The last
entry in the list takes precedennce, avoid spaces between entries -->
<bean
class="org.springframework.beans.factory.config.PropertyPlaceholderConfigurer">
<property name="properties" ref="osfPropsCamel" />
<property name="ignoreUnresolvablePlaceholders" value="true" />
</bean>
<bean id="amqPropertyConfigurer"
class="org.springframework.beans.factory.config.PropertyPlaceholderConfigurer">
<property name="properties" ref="amqEnvProps" />
</bean>
<bean name="prop"
class="org.springframework.beans.factory.config.PropertiesFactoryBean">
<property name="propertiesArray">
<list>
<ref bean="osfPropsCamel" />
<ref bean="amqEnvProps" />
</list>
</property>
</bean>
<bean id="bridgePropertyPlaceholder"
class="org.apache.camel.spring.spi.BridgePropertyPlaceholderConfigurer">
<property name="properties" ref="prop" />
</bean>
</beans>
<beans profile="test">
<bean id="osfCamelPropertyLocation" class="java.lang.String">
<constructor-arg value="#{defaultPropertyFileLocation}" />
</bean>
<bean id="propertyPlaceholderConfigurer"
class="org.springframework.beans.factory.config.PropertyPlaceholderConfigurer">
<property name="locations" ref="osfCamelPropertyLocation" />
</bean>
</beans>
</beans>
以下错误
java.lang.IllegalArgumentException: Cannot convert value of type [javax.naming.Reference] to required type [java.util.Properties] for property 'properties': PropertyEditor [org.springframework.beans.propertyeditors.PropertiesEditor] returned inappropriate value of type [javax.naming.Reference]
[4/7/16 16:34:09:946 CDT] 00000050 SystemErr R at org.springframework.beans.TypeConverterDelegate.convertIfNecessary(TypeConverterDelegate.java:260)
[4/7/16 16:34:09:946 CDT] 00000050 SystemErr R at org.springframework.beans.BeanWrapperImpl.convertIfNecessary(BeanWrapperImpl.java:448)
[4/7/16 16:34:09:946 CDT] 00000050 SystemErr R ... 107 more