前往小程序,Get更优阅读体验!
立即前往
首页
学习
活动
专区
工具
TVP
发布
社区首页 >专栏 >springBoot整合Mq报错:JmsMessagingTemplate that could not be found

springBoot整合Mq报错:JmsMessagingTemplate that could not be found

作者头像
Java深度编程
发布2020-08-05 14:55:03
2.4K0
发布2020-08-05 14:55:03
举报
文章被收录于专栏:Java深度编程Java深度编程

springBoot使用gradle版本管理,在整合activeMQ的时候容易出现一个错误,那就是找不到JmsMessagingTemplate,无法匹MessagingTemplateConfiguration,全部报错信息如下:

代码语言:javascript
复制

Field jmsMessagingTemplate in com.es.basedata.mq.MqProducer 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

可能性一:这可能是mq配置的问题,这时候你需要去检查一下你的springBoot配置文件,配置activeMQ的时候是否加入了pool节点,开启了线程:

代码语言:javascript
复制
  activemq:
    broker-url: tcp://localhost:61616
    user: admin
    password: admin
    pool:
      enabled: true
      max-connections: 50
    #默认包名安全(支持序列化与反序列化)
    packages:
      trust-all: true
  #支持topic订阅模式
  jms:
    pub-sub-domain: true

如果你是这样配置的,需要把enabled: true 改成 false,或者干脆把pool节点干掉。

原理:enabled: true标识开启线程池,由于springBoot也有线程池,两者冲突导致的。

可能性二:

如果按以上的操作还不能解决的话,那就可能是版本的不兼容了。请参考一下版本:

1.springBoot 2.3.1.RELEASE

2.gradle 5.6

3.activeMQ 2.3.1.RELEASE

本文参与 腾讯云自媒体分享计划,分享自微信公众号。
原始发表:2020-07-31,如有侵权请联系 cloudcommunity@tencent.com 删除

本文分享自 Java深度编程 微信公众号,前往查看

如有侵权,请联系 cloudcommunity@tencent.com 删除。

本文参与 腾讯云自媒体分享计划  ,欢迎热爱写作的你一起参与!

评论
登录后参与评论
0 条评论
热度
最新
推荐阅读
领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档