使用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的更多相关文章

  1. SpringBoot注入Mapper提示Could not autowire. No beans of 'xxxMapper' type found错误

    通过用Mabatis的逆向工程生成的Entity和Mapper.在Service层注入的时候一直提示Could not autowire. No beans of 'xxxMapper' type f ...

  2. 分享知识-快乐自己:intellij Idea报错Could not autowire. No beans of...

    intellig idea 使用@Resource或者@Autowire报错,出现红色波浪线: 虽然不影响使用,但是看着很不爽,所以还是解决了下: 报错提示: Could not autowire. ...

  3. spring boot中注入jpa时报could not autowire.No beans of 'PersonRepository' type found

    解决方法,在repository加一个注解.如下图所示: @Component

  4. spring JMS在接收消息的时候总是报错

    spring JMS在接收消息的时候总是报错 org.springframework.jms.UncategorizedJmsException: Uncategorized exception oc ...

  5. IntelliJ IDEA中Mapper接口通过@Autowired注入报错的正确解决方式

    转载请注明来源:四个空格 » IntelliJ IDEA中Mapper接口通过@Autowired注入报错的正确解决方式: 环境 ideaIU-2018.3.4.win: 错误提示: Could no ...

  6. Idea使用记录--添加Problems&&解决Autowired报错could not autowire

    今天在使用Idea的时候,发现Idea在整个每次找到错误代码非常不方便(Idea如果类中有错误,没有打开过类并不会提示,比如构建工程后缺少jar包问题).我想快速看到工程哪里出问题类似于eclipse ...

  7. notification 报错the method build() is undefined for the type Notificatin.Builder

    notification 报错the method build() is undefined for the type Notificatin.Builder 这事api版本号太低导致的 Notifi ...

  8. 【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 ...

  9. 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_ ...

随机推荐

  1. IOS开发---菜鸟学习之路--(八)-实现新闻页面

    本章将具体讲述如何结合前两张的内容最终实现一个新闻页面的雏形 之所以称之为雏形,是因为本章实现的内容只是实现了最基础的效果 还有很多其他诸如下拉刷新 页面导航等效果都需要投入一些时间进行研究 好了直接 ...

  2. Windows核心编程小结1

    这本书绝对经典,看看定会增加不少知识.当然这本书有很多东西比<Windows程序设计第五版>中的更加详细. 1.Unicode:宽字节字符集 这是一个国际的字符标准,16位,最大可支持65 ...

  3. 查看2个Python字典的相同以及不同之处

    a = { "x":1, "y":2, "z":3 } b = { "x":1, "w":11, & ...

  4. python学习-- Django进阶之路 model的 objects对象 转 json

    # objects_to_json: 将 model对象 转化成 json# json_to_objects: 将 将反序列化的json 转为 model 对象 def json_field(fiel ...

  5. Python爬虫作业

    题目如下:   请分析作业页面(https://edu.cnblogs.com/campus/hbu/Python2018Fall/homework/2420),    爬取已提交作业信息,并生成已提 ...

  6. 2018CCPC网络赛

    A - Buy and Resell HDU - 6438 The Power Cube is used as a stash of Exotic Power. There are nn cities ...

  7. java的ArrayList使用方法详解

    ArrayList是Java的链表类,在项目开发中十分常见,那么怎样对ArrayList进行添加.删除.修改.查询.遍历呢?本文将进行详细阐述. 工具/原料   java 一.ArrayList的添加 ...

  8. 指定某个git的版本代码拉取新的分支

    在本地找到一个目录,执行 git clone http://gitlab.xxxxx.com/xxxxx/xxxxx.git cd xxxxx/ git log //找到对应版本的SHA值 例如2b1 ...

  9. List里面的对象被覆盖

    对于for循环,当对象创建在for循环外时,list里面的内容会被覆盖··· 解决办法:把对象创建放入for循环里面: 具体原理:若是放到在for外,对象是同一个,放到for到里面,每次都创建一个新的 ...

  10. Codeforces Round #402 (Div. 2) D. String Game(二分答案水题)

    D. String Game time limit per test 2 seconds memory limit per test 512 megabytes input standard inpu ...