Spring JMS with Spring boot , Conflicting beans -
i creating spring jms listener spring boot, keep getting error:-
org.springframework.beans.factory.nouniquebeandefinitionexception: no qualifying bean of type [javax.jms.connectionfactory] defined: expected single matching bean found 3: queueconnectionfactory,queueconnectionfactoryextra,targetconnectionfactory @ org.springframework.beans.factory.support.defaultlistablebeanfactory.doresolvedependency(defaultlistablebeanfactory.java:1126) @ org.springframework.beans.factory.support.defaultlistablebeanfactory.resolvedependency(defaultlistablebeanfactory.java:1014) @ org.springframework.beans.factory.annotation.autowiredannotationbeanpostprocessor$autowiredfieldelement.inject(autowiredannotationbeanpostprocessor.java:545)
whereever read resolved using @qualifier
annotation doesn't seem work me, please help. below class:-
@configuration public class listenercontainer{ @suppresswarnings("rawtypes") @qualifier("queueconnectionfactory") @bean(name="planlistenercontainerfactoryextra") public jmslistenercontainerfactory jmslistenercontainerfactory(@qualifier("queueconnectionfactory") connectionfactory queueconnectionfactory,@qualifier("queue") mqqueue queue, errorhandler errorhandler) { defaultjmslistenercontainerfactory factory = new defaultjmslistenercontainerfactory(); factory.setconnectionfactory(queueconnectionfactory); factory.seterrorhandler(errorhandler); return factory; } @qualifier("targetconnectionfactory") @bean(name="queueconnectionfactory") public connectionfactory queueconnectionfactory(@qualifier("targetconnectionfactory") mqqueueconnectionfactory targetconnectionfactory) { cachingconnectionfactory queueconnectionfactory = new cachingconnectionfactory(); .... return queueconnectionfactory; } @bean(name="targetconnectionfactory") public mqqueueconnectionfactory targetconnectionfactory() { mqqueueconnectionfactory targetconnectionfactory = new mqqueueconnectionfactory(); return targetconnectionfactory; } @bean(name="queue") public mqqueue queue() { mqqueue queue = new mqqueue(); ..... return queue; } }
Comments
Post a Comment