問題描述:關於springboot2.1.*整合activemq時報錯:required a bean of type 'org.springframework.jms.core.JmsMessagingTemplate'。
搜索網上有些有些人文件的配置信息由空格什麼的,沒能解決。
搜索到一篇正解的文章,完美解決:原因是springboot2.1.x和springboot2.0.x源碼原因導致。
我這邊解決:
<!-- 整合消息隊列ActiveMQ -->
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-activemq</artifactId>
</dependency>
<!-- 如果配置線程池則加入 -->
<dependency>
<groupId>org.messaginghub</groupId>
<artifactId>pooled-jms</artifactId>
</dependency>
<!--<dependency>-->
<!--<groupId>org.apache.activemq</groupId>-->
<!--<artifactId>activemq-pool</artifactId>-->
<!--</dependency>-->
配置線程池依賴改用:<dependency> <groupId>org.messaginghub</groupId> <artifactId>pooled-jms</artifactId> </dependency>
即可。
文章鏈接:https://www.jianshu.com/p/bb396bf573bd
注:在此感謝原文作者。