I have these configuration below on my application context xml
<bean class="org.springframework.context.support.PropertySourcesPlaceholderConfigurer">
<property name="locations">
<list>
<value>classpath:jmsconfig.properties</value>
</list>
</property>
<property name="ignoreUnresolvablePlaceholders" value="true"/>
<property name="order" value="1"/>
</bean>
<bean id="jmsConfigPropertyPlaceHolder" class="org.springframework.context.support.PropertySourcesPlaceholderConfigurer">
<property name="locations">
<list>
<bean class="org.springframework.core.io.FileSystemResource">
<constructor-arg value="#{systemEnvironment['SHARED_DIR']}/messaging/broker.properties" />
</bean>
</list>
</property>
</bean>
<bean id="jmsProperties" class="java.util.Properties">
<constructor-arg>
<props>
<prop key="transportURI">${transportURI}</prop>
<prop key="maxConcurrentConsumers">${maxConcurrentConsumers}</prop>
<prop key="timeToLive">${timeToLive}</prop>
<prop key="cacheConsumer">${cacheConsumer}</prop>
<prop key="cacheProducer">${cacheProducer}</prop>
<prop key="deliveryPersistent">${deliveryPersistent}</prop>
</props>
</constructor-arg>
</bean>
I got the below exception when loading my context
org.springframework.beans.factory.UnsatisfiedDependencyException: Error creating bean with name 'org.springframework.context.support.PropertySourcesPlaceholderConfigurer#0' defined in class path resource [dbaccessContext.xml]: Unsatisfied dependency expressed through bean property 'properties': : No qualifying bean of type [java.util.Properties] is defined: expected single matching bean but found 2: jmsProperties,systemProperties; nested exception is org.springframework.beans.factory.NoUniqueBeanDefinitionException: No qualifying bean of type [java.util.Properties] is defined: expected single matching bean but found 3: jmsProperties,systemProperties
Appreciate for any help on this.
Updated.
I found the root cause that make my context failed to load, because my context had: default-autowire="byType" so Spring will try to inject all my spring property by type.
<beans xmlns="http://www.springframework.org/schema/beans"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:context="http://www.springframework.org/schema/context"
xmlns:aop="http://www.springframework.org/schema/aop" xmlns:mongo="http://www.springframework.org/schema/data/mongo"
xmlns:util="http://www.springframework.org/schema/util"
xsi:schemaLocation="http://www.springframework.org/schema/beans
http://www.springframework.org/schema/beans/spring-beans-3.0.xsd
http://www.springframework.org/schema/context
http://www.springframework.org/schema/context/spring-context-3.0.xsd
http://www.springframework.org/schema/data/mongo
http://www.springframework.org/schema/data/mongo/spring-mongo-1.0.xsd
http://www.springframework.org/schema/aop
http://www.springframework.org/schema/aop/spring-aop-3.0.xsd
http://www.springframework.org/schema/util
http://www.springframework.org/schema/util/spring-util-3.0.xsd"
**default-autowire="byType"**>
After removing default-autowire="byType", my app work now.