Configure a Spring JMS application with Spring Boot and annotation support
来源:互联网 发布:lol美服安装包 mac 编辑:程序博客网 时间:2024/04/26 05:48
- Introduction
In previous posts we learned how to configure a project using Spring JMS. If you check the article introduction to messaging with Spring JMS , you will notice that it is configured using XML. This article will take advantage of the improvements introduced in Spring 4.1 version, and configure a JMS project using Java config only.
In this example we will also see how easy it can be to configure the project by using Spring Boot .
Before we get started, just note that as usual, you can take a look at the source code of the project used in the examples below.
See the example project at github .这里写链接内容
Sections:
Introduction.The example application.Setting up the project.A simple example with JMS listener.Sending a response to another queue with @SendTo.Conclusion.
- The example application
The application uses a Client service to send orders to a JMS queue, where a JMS listener will be registered and handle these orders. Once received, the listener will store the order through the Store service:
We will use the Order class to create orders:
public class Order implements Serializable {
private static final long serialVersionUID = -797586847427389162L;
private final String id;
public Order(String id) {
this.id = id;
}
public String getId() {
return id;
}
}
Before moving on to the first example, we will first explore how the project structure is built.
3. Setting up the project
3.1 Configuring pom.xml
The first thing to do is to define the artifact spring-boot-starter-parent as our parent pom.
org.springframework.boot
spring-boot-starter-parent
1.2.3.RELEASE
This parent basically sets several Maven defaults and provides the dependency management for the main dependencies that we will use, like the Spring version (which is 4.1.6).
It is important to note that this parent pom defines the version of many libraries but it does not add any dependency to our project. So don’t worry about getting libraries you won’t use.
The next step is to set the basic dependencies for Spring Boot:
org.springframework.boot
spring-boot-starter
In addition to the core Spring libraries, this dependency will bring the auto configuration functionality of Spring Boot. This will allow the framework to try to automatically set up the configuration based on the dependencies you add.
Finally, we will add the Spring JMS dependency and the ActiveMQ message broker, leaving the whole pom.xml as follows:
xpadro.spring
jms-boot-javaconfig
0.0.1-SNAPSHOT
jar
JMS Spring Boot Javaconfig
org.springframework.boot
spring-boot-starter-parent
1.2.3.RELEASE
- Configure a Spring JMS application with Spring Boot and annotation support
- Configure a Spring Boot Web Application
- spring mvc annotation and i18n configure
- Spring Boot with Spring MVC Application
- Efficient Lightweight JMS with Spring and ActiveMQ
- spring boot jms activemq
- Spring Boot JMS
- A Simple Web App with Spring Boot, Spring Security and Stormpath – in 15 Minutes
- A Microservice Architecture with Spring Boot and Spring Cloud(一)
- A Microservice Architecture with Spring Boot and Spring Cloud(二)
- A Microservice Architecture with Spring Boot and Spring Cloud(三)
- jms with spring
- jms with spring 2
- Spring AOP @Aspect support annotation
- Spring Boot Security Application
- Spring Boot application.propertis
- Spring Boot Application 运行
- Spring annotation and JSR330
- mysql分表与分区表
- 定位和反查位置信息
- Intellij IDEA 14中使用MyBatis-generator 自动生成MyBatis代码
- 基于CSS3的WEBAPP横向滑动模式演化
- 多校3- RGCDQ
- Configure a Spring JMS application with Spring Boot and annotation support
- POJ 3648 Wedding(2-SAT)
- 【HDOJ 5327】 Olympiad
- 关于spring 3.0.5的<mvc:resources> 标签的使用
- android svn so文件提交
- win7下apache服务器本机可通过ip访问,局域网不能通过ip访问的解决办法
- linux reboot flow
- EXTJs错误:Batch update returned unexpected row count from update [0]; actual row count: 0;
- RedHat下安装httpd,php,elasticsearch