Thanks to visit codestin.com
Credit goes to www.tutorialspoint.com

Spring Boot Resources

Spring Tool Suite, STS



Spring Tool Suite, STS is an IDE (Integrated Development Environment) and is ideal for developing Spring Boot applications.

Download and install STS

  • STS can be downloaded from https://spring.io/tools.

  • Select the Operating System (Windows in this case).

  • Download the zip file and extract.

  • Click on the SpringToolSuite4.exe file.

  • Spring Tool Suite 4 Launcher dialog asks for a workspace location. Enter the location, and press the "Launch" button.

Creating a simple Spring Boot application in STS

  • Go to File -> New Maven Project.

  • Click Next. The following dialog appears:

    Create New Project
  • Select maven-archetype-quickstart

    Create Project Wizard
  • For GroupId, enter com.tutorialspoint, for ArtifactId enter first-spring-boot-example.

    Finish Project Wizard
  • Click Finish.

  • Upon completion, there will be folder structure created −

    Project Explorer

Update pom.xml

Open the pom.xml file. Add the following under dependencies.

<dependency>
   <groupId>org.springframework.boot</groupId>
   <artifactId>spring-boot-autoconfigure</artifactId>
   <version>3.3.3</version>
</dependency>

You can add the spring framework core jars to the build path by right-clicking on project -> Build path -> Add external archives if required.

pom.xml

<project xmlns="http://maven.apache.org/POM/4.0.0" 
   xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" 
   xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 https://maven.apache.org/xsd/maven-4.0.0.xsd">
   <modelVersion>4.0.0</modelVersion>
   <groupId>com.tutorialspoint</groupId>
   <artifactId>first-spring-boot-example</artifactId>
   <version>0.0.1-SNAPSHOT</version>
   <dependencies>
      <dependency>
         <groupId>org.springframework.boot</groupId>
         <artifactId>spring-boot-autoconfigure</artifactId>
         <version>3.5.6</version>
      </dependency>
   </dependencies>
</project>

Create a new Java class under src/main/java with package name com.tutorialspoint.first_spring_boot_example. Name the class FirstSpringBootTestClass.

FirstSpringBootTest.java

package com.tutorialspoint.first_spring_boot_example;

import org.springframework.boot.SpringApplication;    
import org.springframework.boot.autoconfigure.SpringBootApplication;

@SpringBootApplication
public class FirstSpringBootTest {

   public static void main(String[] args) {   
      System.out.println("Hello World, this is First Spring Boot Test");
      SpringApplication.run(FirstSpringBootTest.class, args);
   }
}

Output

From project explorer, right-click on the file FirstSpringBootTest, then Run as -> Java application. On the console, you will see −

Hello World, this is First Spring Boot Test

  .   ____          _            __ _ _
 /\\ / ___'_ __ _ _(_)_ __  __ _ \ \ \ \
( ( )\___ | '_ | '_| | '_ \/ _` | \ \ \ \
 \\/  ___)| |_)| | | | | || (_| |  ) ) ) )
  '  |____| .__|_| |_|_| |_\__, | / / / /
 =========|_|==============|___/=/_/_/_/

 :: Spring Boot ::                (v3.5.6)

[2025-09-28 13:45:47.112] - 42364 INFO [main] --- com.tutorialspoint.first_spring_boot_example.FirstSpringBootTest: Starting FirstSpringBootTest using Java 21.0.6 with PID 42364 (D:\workspace\first-spring-boot-example\target\classes started by mahes in D:\workspace\first-spring-boot-example)
[2025-09-28 13:45:47.161] - 42364 INFO [main] --- com.tutorialspoint.first_spring_boot_example.FirstSpringBootTest: No active profile set, falling back to 1 default profile: "default"
[2025-09-28 13:45:47.830] - 42364 INFO [main] --- com.tutorialspoint.first_spring_boot_example.FirstSpringBootTest: Started FirstSpringBootTest in 1.212 seconds (process running for 1.476)
Advertisements