使用SpringBoot整合ActiveMQ自动注入JmsMessagingTemplate时候的问题

2022-06-21 10:19:19

使用SpringBoot整合ActiveMQ自动注入JmsMessagingTemplate时候的问题


APPLICATION FAILED TO START


Description:

Field template in com.springboot.chapter7.service.imp.ProducerSericeImp required a bean of type ‘org.springframework.jms.core.JmsMessagingTemplate’ that could not be found.

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

The following candidates were found but could not be injected:
- Bean method ‘jmsMessagingTemplate’ in ‘JmsAutoConfiguration.MessagingTemplateConfiguration’ not loaded because Ancestor org.springframework.boot.autoconfigure.jms.JmsAutoConfiguration did not match

Action:

Consider revisiting the entries above or defining a bean of type ‘org.springframework.jms.core.JmsMessagingTemplate’ in your configuration.

我看了一个博主的不知道他的错误是不是和我一样,但是我用他的方法可以改了之后就好了,我的springboot版本的2.2.1

		<!-- 整合消息队列ActiveMQ -->
        <dependency>
            <groupId>org.springframework.boot</groupId>
            <artifactId>spring-boot-starter-activemq</artifactId>
        </dependency>
        <!-- 如果配置线程池则加入 --> 
        就是这个我一开始在网上找的然后不行,后来把这个注释后使用下面的就可以了
        <dependency>
        <groupId>org.apache.activemq</groupId>
        <artifactId>activemq-pool</artifactId>
        </dependency>
        <!--<dependency>
            <groupId>org.messaginghub</groupId>
            <artifactId>pooled-jms</artifactId>
        </dependency>-->

希望帮助到后来的同学

  • 作者:小文不加刘
  • 原文链接:https://blog.csdn.net/weixin_41548836/article/details/103749447
    更新时间:2022-06-21 10:19:19