spring boot 整合 RabbitMQ 错误

1.错误

org.springframework.beans.factory.BeanCreationException: 
Error creating bean with name 'org.springframework.amqp.rabbit.config.internalRabbitListenerAnnotationProcessor' 
defined in class path resource [org/springframework/amqp/rabbit/annotation/RabbitBootstrapConfiguration.class]:
 Bean instantiation via factory method failed; 
 nested exception is org.springframework.beans.BeanInstantiationException: F
 ailed to instantiate [org.springframework.amqp.rabbit.annotation.RabbitListenerAnnotationBeanPostProcessor]: 
 Factory method 'rabbitListenerAnnotationProcessor' threw exception;
 nested exception is java.lang.NoClassDefFoundError: org/springframework/messaging/handler/annotation/support/MessageHandlerMethodFactory

一大堆,不过最关键的是

java.lang.NoClassDefFoundError: org/springframework/messaging/handler/annotation/support/MessageHandlerMethodFactory

这个类没有找见

2.解决:

这个类是通过 spring boot 的web 模块导入的

所以直接在 gradle中  添加

implementation 'org.springframework.boot:spring-boot-starter-web'

即可

 

上一篇:java – 将JMS与AMQP进行比较


下一篇:PHP使用RabbitMQ实例