In this chapter, we will set up our development environment and discuss how we can leverage SpringSource Tool Suite (STS) to its maximum. Although any popular Java development IDE such as Eclipse, intelliJ, NetBeans, and others can be used for developing Spring Integration solutions, pivotal, the company spearheading Spring Integration, recommends that you use STS which is an Eclipse-based IDE.
STS comes with many off-the-shelf plugins, visual editors, and other features, which ease the development of Spring-powered enterprise applications. The look and feel of the IDE is very similar to Eclipse. Install STS by following these steps:
JDK 1.6 and above is a prerequisite, download and install it from http://www.oracle.com/technetwork/java/javase/downloads/java-archive-downloads-javase6-419409.html.
Set
JAVA_HOME
properties as explained in the documentation at https://docs.oracle.com/cd/E19182-01/820-7851/inst_cli_jdk_javahome_t/index.html.Download STS from http://spring.io/tools/sts.
The downloaded file is in ZIP format. Extract it to the preferred folder and it's all set.
Go to
<installation-directory>\sts-bundle\sts-3.6.1.RELEASE
. TheSTS.exe
file is the executable for launching the IDE.This step is optional but can help in efficient functioning of the OS editor—change the memory allocation parameter. Locate
STS.ini
(in the same folder asSTS.exe
) and change the value ofXmx
. For 2 GB, I've put it asXmx2048m
.
The following steps will help you in creating your first project:
Create a Spring Integration project by navigating to File | Spring Project, as shown in the following screenshot:
Under the templates section, select Spring Integration Project - Simple. Provide a project name, for example,
sisimple
, as shown in the following screenshot:Fill in the information required to create a Maven-based project, as shown in this screenshot:
Click on Finish; this will create a project with the name that was provided by us (
sisimple
), as shown in this screenshot:
This project is as simple as it can be. Let's take a quick look at the generated Java classes in the following points:
Main.java
: This file is located at the path:/sisimple/src/main/java/com/chandan/example/si/
. It has the main method and will be used to run this sample. Right-click on this file from the package explorer and click on Run As | Java Application—this will start the program. This class has the code to bootstrap Spring Integration configuration files and load components defined in it. Additionally, it converts user input to upper case.StringConversionService.java
: This file is located at the path:/sisimple/src/main/java/com/chandan/example/si/service/
. This is the service interface that is used to convert user input to upper case.spring-integration-context.xml
: This file is located at the path:/sisimple/src/main/resources/META-INF/spring/integration/
. It is the Spring Integration configuration file. It contains the XML-based declaration of Spring Integration components.log4j.xml
: This file is located at the path:/sisimple/src/main/resources/
. It is theLog4j
configuration file. It can be edited to control the log level, appenders, and other logging-related aspects.StringConversionServiceTest.java
: This file is located at the path:/sisimple/src/test/java/com/chandan/example/si/
. This is the test file forStringConversionService
. This will be used to run tests against the service classes.pom.xml
: This is the file used for rmaven dependency management, located in/sisimple/
. It has entries for all the dependencies used by the project.
It will be a bit heavy and premature to explain each of the components in these classes and configuration files without having built up some theoretical concepts—we will discuss each of the elements in detail, as we move ahead in the chapters.
STS provides visual ways to add different namespaces. Locate spring-integration-context.xml
under /sisimple/src/main/resources/META-INF/spring/integration/
and open it. This is the default Spring configuration file. Click on the Namespaces tab to manage different namespaces of Spring Integration. The following screenshot shows imported namespaces for this sample project:

In the same editor, clicking on the Integration-graph tab will open a visual editor, which can be used to add/modify or delete endpoints, channels, and other components of Spring Integration. The following screenshot contains the integration graph for our sample project:

Let's have a quick look at the generated Maven POM—overall, there are three dependencies; only one for Spring Integration, and the other ones for Junit and log4j, as shown in the following screenshot:

This is still in the very early stages and is an incubation project. Scala DSL should not be confused with other EIP implementations being offered in Scala—rather, it is built on top of Spring Integration and provides DSL-based configuration and flow management.
Note
Check out the official Spring Integration Scala DSL blog at http://spring.io/blog/2012/03/05/introducing-spring-integration-scala-dsl/ and the GitHub page at https://github.com/spring-projects/spring-integration-dsl-groovy.
In this chapter, you learned how to set up your IDE and created a basic project. We also tried our hands at the visual editor of STS and covered a quick introduction of the upcoming Scala DSL for Spring Integration. We will leverage this knowledge to build a compelling Spring Integration application using STS throughout the rest of the chapters.
In the next chapter, we will cover how to ingest messages in the application and then how to process them.