We can also use Spring Tool Suite to create a Spring project. In this section, we will create a Maven Project using STS.
Spring Tool Suite 4 makes it easy to get started. Google chrome it is. A direct and easy-to-use integration of the Spring Initializr and the famous Spring Guides allows you to go from nothing to a running Spring Boot app in seconds. Navigate your spring code Understanding and quickly navigating source code is essential for coding. EGit About This Project. EGit is an Eclipse Team provider for the Git version control system.Git is a distributed SCM, which means every developer has a full copy of all history of every revision of the code, making queries against the history very fast and versatile.
- The lombok.jar can be copied into the root Eclipse or Spring Tool Suite folder and run like this: java -jar lombok-1.16.12.jar This will open a small UI, where the location of the Eclipse installation can be specified.
- Last modified: Sat May 09 15:32:48 UTC 2015: Last modified by: tim.lebedk. Created: Sat May 09 15:32:48 UTC 2015: Created by: tim.lebedk. Automated tests.
Step 1: Open the Spring Tool Suite.
Step 2: Click on the File menu -> New -> Maven Project
It shows the New Maven Project wizard. Click on the Next button.
Step 3: Select the maven-archetype-quickstart and click on the Next button.
Step 4: Provide the Group Id and Artifact Id. We have provided Group Id com.javatpoint and Artifact Id spring-boot-example-sts. Now click on the Finish button.
When we click on the Finish button, it creates the project directory, as shown in the following image.
Step 5: Open the App.java file. We found the following code that is by default.
The Maven project has a pom.xml file which contains the following default configuration.
Step 6: Add Java version inside the <properties> tag.
Step 7: In order to make a Spring Boot Project, we need to configure it. So, we are adding spring boot starter parent dependency in pom.xml file. Parent is used to declare that our project is a child to this parent project.
Step 8: Add the spring-boot-starter-web dependency in pom.xml file.
Note: When we add the dependencies in the pom file, it downloads the related jar file. We can see the downloaded jar files in the Maven Dependencies folder of the project directory.
After adding all the dependencies, the pom.xml file looks like the following:
Step 9: Create a class with the name SpringBootExampleSts in the package com.javatpoint.
Right-click on the package name -> New -> Class -> provide the class name -> Finish
Step 10: After creating the class file, call the static method run() of the SpringApplication class. In the following code, we are calling the run() method and passing the class name as an argument.
Spring Tool Suite Git Pull
Step 11: Annotate the class by adding an annotation @SpringBootApplication.
A single @SpringBootApplication annotation is used to enable the following annotations:
- @EnableAutoConfiguration: It enables the Spring Boot auto-configuration mechanism.
- @ComponentScan: It scans the package where the application is located.
- @Configuration: It allows us to register extra beans in the context or import additional configuration classes.
Spring Tool Suite Github
Step: Run the file SpringBootExampleSts.java, as Java Application. It displays the following in the console.
The line Started SpringBootExampleSts in 5.038 seconds (JVM running for 6.854) in the console shows that the application is up and running.