【ActiveMQ】消息生产者自动注入报错:Could not autowire. No beans of 'JmsMessagingTemplate' type found
使用ActiveMQ过程中,定义消息生产者:
package com.sxd.jms.producer; import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.jms.core.JmsMessagingTemplate;
import org.springframework.stereotype.Service; import javax.jms.Destination; @Service("producer")
public class Producer1 { @Autowired // 也可以注入JmsTemplate,JmsMessagingTemplate对JmsTemplate进行了封装
private JmsMessagingTemplate jmsTemplate;
// 发送消息,destination是发送到的队列,message是待发送的消息 public void sendMessage(Destination destination, final String message){
jmsTemplate.convertAndSend(destination, message);
} }
但是IDE报错:
启动编译,依旧是报错:
Description: Field jmsTemplate in com.sxd.jms.producer.Producer1 required a bean of type 'org.springframework.jms.core.JmsMessagingTemplate' that could not be found.
- Bean method 'jmsMessagingTemplate' not loaded because Ancestor org.springframework.boot.autoconfigure.jms.JmsAutoConfiguration did not match Action: Consider revisiting the conditions above or defining a bean of type 'org.springframework.jms.core.JmsMessagingTemplate' in your configuration.
解决方式:
因为application.properties中配置ActiveMQ的相关配置后面有空格:
把配置后面的空格去掉。保存,重新编译。
解决了!!!!
【ActiveMQ】消息生产者自动注入报错:Could not autowire. No beans of 'JmsMessagingTemplate' type found的更多相关文章
- SpringBoot注入Mapper提示Could not autowire. No beans of 'xxxMapper' type found错误
通过用Mabatis的逆向工程生成的Entity和Mapper.在Service层注入的时候一直提示Could not autowire. No beans of 'xxxMapper' type f ...
- 分享知识-快乐自己:intellij Idea报错Could not autowire. No beans of...
intellig idea 使用@Resource或者@Autowire报错,出现红色波浪线: 虽然不影响使用,但是看着很不爽,所以还是解决了下: 报错提示: Could not autowire. ...
- spring boot中注入jpa时报could not autowire.No beans of 'PersonRepository' type found
解决方法,在repository加一个注解.如下图所示: @Component
- spring JMS在接收消息的时候总是报错
spring JMS在接收消息的时候总是报错 org.springframework.jms.UncategorizedJmsException: Uncategorized exception oc ...
- IntelliJ IDEA中Mapper接口通过@Autowired注入报错的正确解决方式
转载请注明来源:四个空格 » IntelliJ IDEA中Mapper接口通过@Autowired注入报错的正确解决方式: 环境 ideaIU-2018.3.4.win: 错误提示: Could no ...
- Idea使用记录--添加Problems&&解决Autowired报错could not autowire
今天在使用Idea的时候,发现Idea在整个每次找到错误代码非常不方便(Idea如果类中有错误,没有打开过类并不会提示,比如构建工程后缺少jar包问题).我想快速看到工程哪里出问题类似于eclipse ...
- notification 报错the method build() is undefined for the type Notificatin.Builder
notification 报错the method build() is undefined for the type Notificatin.Builder 这事api版本号太低导致的 Notifi ...
- 【spring mvc】后台spring mvc接收List参数报错如下:org.springframework.beans.BeanInstantiationException: Failed to instantiate [java.util.List]: Specified class is an interface
后台spring mvc接收List参数报错如下:org.springframework.beans.BeanInstantiationException: Failed to instantiate ...
- Oracle:oracle 12.1.0.2 升级到12.2.0.1 后,自动任务报错:ORA-20001: Statistics Advisor: Invalid task name for the current user
具体错误如下:关键字:ORA-12012.ORA-20001 ORA-12012: error on auto execute of job "SYS"."ORA$AT_ ...
随机推荐
- flex布局之flex-grow和flex-shrink如何计算
此文已由作者张含会授权网易云社区发布. 欢迎访问网易云社区,了解更多网易技术产品运营经验. 关于盒模型布局 如何实现两栏布局? (表格) 流式, 浮动, 定位 如何选择? 流式 > 浮动 > ...
- Python+Selenium练习篇之21-如何截图并保存
本文介绍如何利用Selenium的方法进行截图,在测试过程中,是有必要截图,特别是遇到错误的时候进行截图.在selenium for python中主要有三个截图方法,我们挑选其中最常用的一种. ge ...
- CSU-1974 神奇药水
CSU-1974 神奇药水 Description 对于csuxushu来说,能够在CSU(California State University)组织2017年的ACM暑期集训让他感到十分荣幸. ...
- 安装的 Python 版本太多互相干扰?pyenv 建议了解一下。
写在之前 我们都知道现在的 Python 有 Python2 和 Python3,但是由于各种乱七八糟的原因导致这俩哥们要长期共存,荣辱与共,尴尬的是这哥俩的差异还比较大,在很多时候我们可能要同时用到 ...
- PAT——乙级1012
1012 数字分类 (20 point(s)) 给定一系列正整数,请按要求对数字进行分类,并输出以下 5 个数字: A1 = 能被 5 整除的数字中所有偶数的和: A2 = 将被 5 除后 ...
- springmvc支持跨域的请求(复制)
Spring MVC 新增跨域支持 发表于2017/5/8 22:01:24 48人阅读 分类: SpringMVC Spring MVC 4.2 增加 CORS 支持 跨站 HTTP 请求(Cro ...
- jQuery操作DOM基础 - 创建节点
案例:创建两个<li>元素节点,并且作为<ul>元素节点的子节点,添加到DOM树中 <!DOCTYPE html> <html lang="en&q ...
- border-radius元素overflow:hidden失效问题
父元素使用border-radius和overflow:hidden做成圆形,子元素如果使用了transform属性,则父元素的overflow:hidden会失效. 解决方法: 父元素使用 -wei ...
- 开发人员为组件添加自定义的className
在开发过程当中需要给组件写上自己的样式,这个时候怎么办呢? 直接给组件添加className这样是无效的 当给组件添加className之后 在写组件的时候需要对使用你的组件的开发人员提供自定义cla ...
- Bzoj2829 信用卡凸包
Time Limit: 10 Sec Memory Limit: 128 MBSec Special JudgeSubmit: 333 Solved: 155 Description Input ...