解决springboot+activemq启动报注解错误的问题

软件发布|下载排行|最新软件

当前位置:首页IT学院IT技术

解决springboot+activemq启动报注解错误的问题

jingxian   2021-07-26 我要评论
想了解解决springboot+activemq启动报注解错误的问题的相关内容吗,jingxian在本文为您仔细讲解的相关知识和一些Code实例,欢迎阅读和指正,我们先划重点:springboot注解,activemq启动,报注解错误,下面大家一起来学习吧。

springboot+activemq启动报注解错误

Description:
 
Field jmsMessagingTemplate in com.haozz.demo.mq.PromoteActProducer 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.

原因总结有以下3点原因:

1.spring.activemq.pool.enabled=true,线程池开启,后面有空格,且没有引入线程池包

       <dependency>
            <groupId>org.apache.activemq</groupId>
            <artifactId>activemq-pool</artifactId>
        </dependency>

2.springboot版本问题不支持,建议用2.0版本启动

<parent>
        <groupId>org.springframework.boot</groupId>
        <artifactId>spring-boot-starter-parent</artifactId>
        <version>2.0.1.RELEASE</version>
        <relativePath /> <!-- lookup parent from repository -->
    </parent>

猜想:估计是因为2.1.0+版本有自己的线程池管理,导致冲突

3.spring.activemq.pool.enabled=false,关闭线程池

Copyright 2022 版权所有 软件发布 访问手机版

声明:所有软件和文章来自软件开发商或者作者 如有异议 请与本站联系 联系我们