Home > Back-end >  Spring injection RabbitTemplate problem bosses (o)
Spring injection RabbitTemplate problem bosses (o)

Time:09-17

There is a demand by the RabbitMQ push messages to customers, if you use the @ Bean + @autowired way, when the connection problems, project startup initialization Bean will be submitted to the exception, but if every time to push to initialize the connection + RabbitTemplate, as if also not quite right, this kind of situation usually how to solve?

CodePudding user response:

Initialize the way you have any question, advice to see org. Springframework. Boot. Autoconfigure. Closer. RabbitAutoConfiguration configuration and this also need not you, in accordance with the provisions of the it is to don't need you to initialize

CodePudding user response:

Add annotations on bean @ Lazy Lazy loading
Not even though project startup mq, you should go to mq problems rather than bypass bean initialization
  • Related