解决:A component required a bean of type ‘javax.jms.Queue‘ that could not be found.
前些天发现了一个巨牛的人工智能学习网站,通俗易懂,风趣幽默,忍不住分享一下给大家。点击跳转到教程。
1. 情景描述:只是想简单写个 ActiveMQ 的小样,启动服务却报错:
Error starting ApplicationContext. To display the auto-configuration report re-run your application with 'debug' enabled.
2018-08-01 16:10:39.858 ERROR 4928 --- [ main] o.s.b.d.LoggingFailureAnalysisReporter : ***************************
APPLICATION FAILED TO START
***************************Description:A component required a bean of type 'javax.jms.Queue' that could not be found.Action:Consider defining a bean of type 'javax.jms.Queue' in your configuration.
2. 原因和解决:
如提示信息中说的一样,Queue 类没有纳入spring 的管理。加上注解: @Bean 就行了。
错误写法:
/*** @author silence* @date 2018/8/1 10:42*/
@Component
public class MessageQueue{public Queue queue(){return new ActiveMQQueue("my-message");}}
正确写法:
package gentle.activemq;import org.apache.activemq.command.ActiveMQQueue;
import org.springframework.context.annotation.Bean;
import org.springframework.stereotype.Component;
import javax.jms.Queue;/*** @author silence* @date 2018/8/1 10:42*/
@Component
public class MessageQueue{@Bean //返回一个名为 my-message 的队列,并且注册为 beanpublic Queue queue(){return new ActiveMQQueue("my-message");}}
3. 成功启动服务:
解决:A component required a bean of type ‘javax.jms.Queue‘ that could not be found.相关推荐
- A component required a bean of type ‘XXX‘ that could not be found 解决办法
springboot应用启动的时候,bean的加载扫描失败,错误信息如下A component required a bean of type 'XXX' that could not be foun ...
- 【已解决】A component required a bean of type ‘XXService‘ that could not found
一.问题 使用了Mybatis generator自动生成的bean和mapper 写完service层和controller层后运行报错A component required a bean of ...
- A component required a bean of type ‘com.lw.mapper.StudentMapper‘ that could not be found.
当我们用springboot整合mybatis时,发生以下错误 Description:A component required a bean of type 'com.lw.mapper.Stude ...
- 【A component required a bean of type ‘‘ that could not be found】
A component required a bean of type 'cn.gson.oasys.model.dao.managework.mappers.MwDetailsMapper' tha ...
- SpringBoot中service注入失败 出现A component required a bean of type 'com.czxy.changgou3.mapper.OrderGoodsMa
错误信息 Error starting ApplicationContext. To display the conditions report re-run your application wit ...
- 调用不同模块A component required a bean of type ‘com.qhzx.td.service.OtcPurchaseSellOutManageService‘ that
springboot应用启动的时候,bean的加载扫描失败,错误信息如下A component required a bean of type 'XXX' that could not be foun ...
- A component required a bean of type ‘com.wyh.service.XXX‘ that could not be found.
A component required a bean of type 'XXXService' that could not be found 组件需要找不到"Service"类 ...
- 错误:Parameter 0 of method sqlSessionFactory in MyBatisConfig required a bean of type ‘javax.sql.DataS
SpringBoot启动错误: *************************** APPLICATION FAILED TO START ***************************D ...
- 解决A component required a bean named ‘entityManagerFactory‘ that could not be found
SpringBoot 整合 Spring Data JPA 报警 1.问题 2.三步走 2.1检查依赖 2.2删除依赖 2.3检查DB配置类 1.问题 ************************ ...
最新文章
- virtualbox下宿主机与虚拟机互通
- 信息系统项目管理师——成本管理
- JS汉字转拼音带音标
- Mr. Tsogt Batbayar 担任BCF理事
- vi/vim操作手册
- 移动硬盘插入提示需要格式化RAW_移动硬盘怎么分区,硬盘分区教程学习
- 庞博 上海交大计算机系,那个脱口秀的段子手——交大帅哥庞博
- elasticsearch中基于slop参数实现近似匹配
- 数据正态分布化 + 基于回归算法的房价预测(含python代码)
- 2021年中国CRM市场规模及市场格局分析:市场规模达156亿元[图]
- 【资源分享】如何画出论文中漂亮的图?
- 调查显示企业SOA应用率仍然很低
- wps字体缺失,问题
- SSM人才交流平台的开发毕业设计-附源码
- 1007	 Rikka with Travels	Rikka with Travels
- 我的雷电游戏(重力感应控制)
- 出现10048和9017错误提示的处理
- 2021长安二中高考成绩查询,陕西33所高中2020年高考数据已公布!速看
- 使用numpy进行9宫格图像拼接
- Sublime Text3 快捷键
热门文章
- 一步步编写操作系统 10 cpu的实模式
- 【HDU - 5014】Number Sequence(贪心构造)
- 【蓝桥杯 - 真题】六角幻方(dfs+剪枝)
- 图解算法学习笔记(二): 选择排序
- android开发百度地图坐标偏差,利用百度地图Android sdk高仿微信发送位置功能及遇到的问题...
- 自定义函数删除字母C语言,[编程入门]自定义函数之字符提取-题解(C语言代码)...
- java中的values函数_巧用valueat函数(快逸免费版)
- 求以下double数组的平均值(四舍五入保留两位小数):
- Toad for Oracle9.7中导入数据库以后,数据有中文乱码:
- Python之分组级运算——【transform()方法、apply()方法】