1.JMS(ActiveMQ)
Spring Boot支持的jms有:ActiveMQ、Artemis、HornetQ
三个加入相应 jar包即可以使用
一、添加依赖
<!-- jms -->
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-activemq</artifactId>
</dependency>二、配置文件
# ACTIVEMQ (ActiveMQProperties)
spring.activemq.in-memory=true
#spring.activemq.broker-url=
#spring.activemq.password=
#spring.activemq.user=
#spring.activemq.packages.trust-all=false
#spring.activemq.packages.trusted=
#spring.activemq.pool.configuration.*=
#spring.activemq.pool.enabled=false
#spring.activemq.pool.expiry-timeout=0
#spring.activemq.pool.idle-timeout=30000
#spring.activemq.pool.max-connections=1三、代码实现
启动注解:
@EnableJms 添加在main方法上面
所涉及文件

配置队列
util/configuration/JmsConfiguration.java
component/DemoJmsComponent.java
测试
资料
Last updated
Was this helpful?