簡體   English   中英

RabbitMQ 未在 Spring Boot 中自動配置

[英]RabbitMQ is not getting auto-configured in Spring Boot

當我查看 Spring Boot 官方文檔時,它說 Spring Boot 將自動配置 RabbitMQ 並為RabbitTemplate生成一個 bean,但是,當我使用@Autowired注入它時,應用程序無法啟動並給我這個錯誤消息:

Field rabbitTemplate in xxx.xxx.queue.publisher.XXXPublisher required a bean of type 'org.springframework.amqp.rabbit.core.RabbitTemplate' that could not be found.

The injection point has the following annotations:
    - @org.springframework.beans.factory.annotation.Autowired(required=true)

有誰知道為什么它不自動配置它? 我將不勝感激任何答案!

PS:我的主類中有@SpringBootApplication@EnableAutoConfiguration注釋:

@SpringBootApplication
@EnableAutoConfiguration
@EnableTransactionManagement
@EnableRetry
@EnableAsync
@EnableScheduling
public class XXXApplication{

    public static void main(String[] args) {
        SpringApplication.run(XXXApplication.class, args);
    }

}

好吧,事實證明這是因為我之前以某種方式明確排除了application.properties文件中的RabbitAutoConfiguration ......

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM