Sts Eclipse

Posted on  by admin

1. Overview

This article illustrates some of the useful features of the Eclipse Spring Tool Suite (STS) IDE, which are useful when developing Spring applications.

First we show the benefits of using STS as compared to the traditional way of building applications with Eclipse.

The Spring Tool Suite (STS) is an Eclipse based toolbox for Spring development, containing features such as a Boot Dashboard, support to the whole Spring ecosystem and native integration with Maven, Gradle and Git. Java Development Kit – click on Windows, Ubuntu or CentOS/RHEL to follow to the tutorial; Spring Tool Suite on. Instead add them to the available update sites in your Eclipse/STS preferences or paste them into the 'Install New Software' dialog. For Eclipse 2021-03. Every once in a while the Spring config editor disappears until a clean Eclipse installation is performed and the STS reinstalled. Eclipse.buildId=I201 java.version=1.6.024 java.vendor=Sun Microsystems Inc. BootLoader constants: OS=win32, ARCH=x8664, WS=win32, NL=enGB Framework arguments: -product org.eclipse.epp.package.jee.product. The STS theme is a color scheme for eclipse created by Kallen. It has been downloaded 2039 times and provides support for a lot of common editors.

Thereafter, we focus on how to bootstrap an application, how to run it and how to add additional dependencies. Finally we conclude by adding application arguments.

2. STS Main Features

STS is an Eclipse-based development environment that is customized for the development of Spring applications.

It provides a ready-to-use environment to implement, debug, run and deploy your applications. It also includes integration for Pivotal tc Server, Pivotal Cloud Foundry, Git, Maven and AspectJ. STS is built as an addition on top of the latest Eclipse releases.

2.1. Project Configuration

STS understands almost all of the most common Java project structures. It parses configuration files and then displays detailed information about beans that are defined, dependencies, used namespaces and in addition extracts overviews for certain stereotypes.

2.2. STS Features Overview

Eclipse STS validates your project and provides quick fixes for your applications. For example, when working with Spring Data JPA, the IDE may be used to validate query method names (more on this in section 6).

STS also provides a graphical view on all bean methods and their mutual relationships. You may want to have a closer look at the graphical editors that come with STS by looking into the views that are available under the menus window, show view and then Spring respectively.

STS also offers other additional useful features that are not limited to Spring applications only. The reader is recommended to a look at the full list of features that can be found here.

3. Creation of a Spring Application

Let us start by bootstrapping a simple application. Without STS a Spring application is usually created by using the Spring Initializer website or the Spring Boot CLI. This may be simplified by clicking on Create Spring Starter Project from your dashboard in STS.

In the New Spring Starter Project screen either use the defaults or make your own adjustments and then go to next screen. Select Web and click finish. Your pom.xml should now look similar to this:


Your version of Spring Boot may be different but the latest version may always be found here.

4. Running the Application

The aforementioned application may be started by right-clicking on the project and selecting run as Spring Boot App. Without STS, you will most likely run the application from the command-line with the following command:

By default Spring applications are started with Tomcat running on port 8080. At this point, the application starts on port 8080 and basically does nothing else as we did not implement any code yet. Section 8 shows you how to change the default port.

5. Logging and ANSI Console

When you run the project from the IDE using the run command, you will notice that the console outputs some nice color-coded log statements. In case you want to turn it off, go to run configurations… and disable the check box Enable ANSI console output on the Spring Boot tab. Alternatively you can also disable it by setting a properties value in the file.

More information on the configuration of your application logs may be found here.

6. JPA Query Name Checks

At times implementing a data access layer may be a cumbersome activity. A lot of boilerplate code may have to be written to realize simple queries and perform pagination. Spring Data JPA (JPA) aims to significantly facilitate such an implementation of data access layers. This section illustrates some of the benefits of using JPA in conjunction with STS.

To get started, add the following dependency for JPA to the previously generated pom.xml:

You may have noticed that version has not been specified in the above declaration. This is due to the fact that dependencies are managed by the spring-boot-starter-parent.

To make JPA work, it is required that you properly define your entity managers and transaction managers. However, Spring auto-configures these for you. The only thing left to the developer is to create the actual entity classes. These entities are managed by the entity manager, which in turn is created by the container. Let us for example create an entity class Foo like so:

The container scans all classes annotated with @Entity from the root of the configuration package. Next we create a JPA repository for the Foo entity:

At this point you may have noticed already that the IDE now flags this query method with an exception:

This is of course due to the fact that we have accidentally written an ‘s' in the method name of the JPA repository. To fix this remove the spurious ‘s' like so:

Notice that no @EnableJpaRepositories was used on the config class. This is because the container's AutoConfigration pre-registers one for the project.

7. Jar Type Search

“Jar Type Search” is a feature that was introduced in STS 3.5.0. It provides content-assisted proposals in projects for classes that are not (yet) on the classpath. STS may help you adding dependencies to your POM file in case they are not yet on the classpath.

For example, let us add a line to the Foo entity class. For this example to work properly, please ensure first that the import statement for java.util.List is already present. Now we may add Google Guava as follows:

The IDE will suggest several dependencies to be added to the classpath. Add the dependency from,press return and add the dependency from Guava. The Guava jar will now automatically be added to your pom.xml file like so:

As of version STS 3.8.0, you get a confirmation dialog box before STS makes its changes to your pom.xml.

8. Adding Application Arguments

One of the other powerful features of Spring is the support of external configurations which can be passed to an application in several ways, e.g. as command-line arguments, specified in properties or YAML files or as system properties. In this section, we focus on adding a configuration option as application start argument using STS. This is illustrated by configuring Tomcat to start on a different port.

In order to run an application on a Tomcat port other than the default, you may use the command below, where a custom port is specified as command-line argument:

When using STS, you have go to the run menu. Select run configurations… from the Run Configurations dialog, select Spring Boot App from the left panel and select demo – DemoApplication (this will be different if you did not select the default project). From (x)= Arguments tab type in the Program Arguments window

and run. You should see output in your console similar to the output that is shown below:

9. Conclusion

In this article we have shown the basics of developing a Spring project in STS. Some of the things we have shown are execution of applications in STS, support during the development of Spring Data JPA and the usage of command-line arguments. However, there are many more useful features that may be employed during development as STS offers a rich set of features.

The full implementation of this article can be found in the github project – this is an Eclipse based project, so it should be easy to import and run as it is.

Get started with Spring 5 and Spring Boot 2, through the Learn Spring course:


Get started with Spring 5 and Spring Boot 2, through the Learn Spring course:



STS IDE (Spring Tool Suite) is an eclipse based IDE (Integrated development environment) for developing Spring applications. It provides massive support for the implement, run, deploy, debug the Spring applications. Further, it allows us to built large applications from scratch.

STS IDE integration is available for other code editors such as VSCode, Theia IDE, eclipse, and more. It provides world-class supports for these IDEs.

In this section of learning Spring Boot series, we will see how to download, install, setup, and getting started with the STS IDE.

Download STS IDE

To download STS IDE, visit Select your required platform. In this tutorial, we are using the Linux platform. But I will explain each step for installing in Windows too.

Installation of STS IDE

Follow the below steps to install STS IDE:

Step1: Extract the zip file and select the executable file (.exe for Windows). It can be located under package “spring-tool-suite-4-4.7.0.RELEASE-e4.16.0-linux.gtk.x86_64”.

Double click on the SpringToolSuite4 file.

Step2: The installation process of the STS IDE begins:

It will take a while and install the STS IDE. On your system.

Step3: Next, it will ask for the default workspace.

Select your default workspace and click on the Launch button to proceed.

Sts eclipse plugin install

Step4: Now, it will start configuring the specified workspace.

Step5: The Spring Tool Suite is successfully installed on your machine. It will look like:

Getting Started With STS (Spring Tool Suite)

As we have installed STS, now launch the STS and start creating and exporting project with it. Let’s import a getting started guide to understand how to import projects in STS.

To import the getting started guide. Navigate it to File-> New-> Import Spring Getting started content. Consider the below image:

A popup window will open which ask you to search and select the any of published guide from the spring website. You can either scroll the given list or search for your requirement.

You can select the build tool (Maven or Gradle) as per your need. They’re also a code set option is available to decide whether to grab the initial code set or complete code set. You can select both options.

The initial code set option provides an empty project and the complete code set option provides the code from the guide. Both options are selected to compare your work against the guide.

Sts Eclipse

I have selected the spring boot guide option. It will import a guide for developing spring boot applications. It will open a browse tab inside your STS IDE having the getting started guide.