java - Auto-injection custom ErrorHandler in spring-rabbitmq -
we know can inject custom message converter:
@bean messageconverter messageconverter(){ return new custommessageconverter(); } however in case of errorhandler doesn't work. why ? can conclude code in way ?
that's true. spring boot's rabbitannotationdrivenconfiguration doesn't support injection.
you have declare own simplerabbitlistenercontainerfactory @bean , supply desired errorhandler injection, other required options, including messageconverter.
note overriding out-of-the-box bean should specify own 1 rabbitlistenercontainerfactory name meet condition:
@bean @conditionalonmissingbean(name = "rabbitlistenercontainerfactory") public simplerabbitlistenercontainerfactory rabbitlistenercontainerfactory(
Comments
Post a Comment