spring整合RabbitMQ配置异常

2018-06-17  本文已影响12人  onlyHalfSoul

最近在整合RabbitMQ时spring报错

Caused by: org.springframework.beans.factory.parsing.BeanDefinitionParsingException: Configuration problem: A 'connection-factory' attribute must be set.
Offending resource: ServletContext resource [/WEB-INF/spring/rabbitmq/config.xml]

从报错中可以看下,是某个bean缺少connection-factory的属性,仔细对比后发现是此处问题:

<rabbit:template exchange="messageExchange" id="rabbitTemplate" />

改后:

<rabbit:template exchange="messageExchange" id="rabbitTemplate" connection-factory="connectionFactory"/>

很傻的错误,太疏忽了,template一定要注意连接属性注入。

上一篇 下一篇

猜你喜欢

热点阅读