How to start Spring Integration with Spring Boot

In the tutorial, JavaSampleApproach will show you how to build a simple Spring Integration with Spring Boot.

Related post:
How to use Spring Integration Http Inbound with Spring Boot


I. Technologies

– Java 1.8
– Maven 3.3.9
– Spring Tool Suite – Version 3.8.1.RELEASE
– Spring Boot: 1.5.1.RELEASE

II. Overview

In the tutorial, we create a simple Spring Integration Appliation with Http Inbound Gateway for support-method: GET.

spring boot spring integration overview http inbound gate

1. Project Structure

spring boot spring integration overview project

2. Step to do

– Create Spring Boot project
– Create a simple message
– Create a Service Activator
– Config Http Inbound GateWay
– Run and Enjoy Results

III. Practices
1. Create Spring Boot project

– Open Spring Tool Suite, on main menu, choose File->New->Spring Starter Project, input project info. Press Next then Finish, a Spring Boot project will be created successfully.

Add dependencies:
spring-boot-starter-integration
spring-integration-http
spring-boot-starter-web
Details:

2. Create a simple message

3. Create a Service Activator

4. Config Http Inbound GateWay

Create a xml config file integration.xml:

Use int-http:inbound-gateway for GET http method.
The pathvariable name will be payload message:
path="/welcome/{name}" payload-expression="#pathVariables.name"
Element: service-activator is used to define an endpoint: WelcomeEndpoint:

Config @ImportResource(“classpath:integration.xml”) in main class:

5. Run and Enjoy Results

Build and Run the project with SpringBoot App mode.
Make a request: http://localhost:8080/welcome/Jack with header Content-Type:application/json .
Result:
spring boot spring integration result

IV. Sourcecode

SpringIntegration


Related Posts


Got Something To Say:

Your email address will not be published. Required fields are marked *

*