最近遇到一个问题,我的@RabbitListener注解失效了,原因是底层组件原因
@SpringBootApplication(exclude = org.springframework.boot.autoconfigure.amqp.RabbitAutoConfiguration.class)
在排除掉自动配置之后,在代码里声明queue和exchange其实是不会自动被创建的,需要自己写一个config类,进行rabbit配置
package org.jeecgframework.boot.conf;import jakarta.annotation.Resource;
import org.springframework.amqp.rabbit.connection.CachingConnectionFactory;
import org.springframework.amqp.rabbit.connection.ConnectionFactory;
import org.springframework.amqp.rabbit.core.RabbitAdmin