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'
即可