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

本文解决SpringBoot结合ActiveMQ启动时遇到的注解错误问题,包括线程池配置、版本兼容性和配置调整。通过引入activemq-pool依赖、使用合适版本的spring-boot-starter-parent及正确配置spring.activemq.pool.enabled参数。

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.
 

解决方案

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

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

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

org.springframework.boot spring-boot-starter-parent 2.0.1.RELEASE

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

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

评论
成就一亿技术人!
拼手气红包6.0元
还能输入1000个字符
 
红包 添加红包
表情包 插入表情
 条评论被折叠 查看
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值