Spring Framework Tutorial
Software Setup and Configuration (STS/Eclipse/IntelliJ)
Core Spring
Spring Annotations
Spring Data
Spring JDBC
Spring Security
Spring Tool Suite (STS) is an Eclipse-based IDE designed specifically for Spring development, making it easier to create and manage Spring Boot projects. Here's a step-by-step guide to setting up a Spring Boot project in STS:
Start the STS IDE. If it's your first time, you'll be prompted to select a workspace location. The workspace is the directory where your projects will be stored.
File
in the top menu.New
> Spring Starter Project
.In the New Spring Starter Project
dialog, you'll be prompted to provide:
Name: The name of your project.
Type: Choose the build tool (Maven or Gradle). Maven is commonly used.
Packaging: JAR (recommended for Spring Boot) or WAR.
Java Version: Choose the Java version you want to use.
Language: Java, Kotlin, or Groovy. Java is most common.
Group: Base package for your project, typically in the format of com.example
.
Artifact: A unique ID for your project.
Version: Project version.
Description: Brief description of your project.
Package: Package structure for your main application, which is typically derived from the Group and Artifact values.
Click Next
.
In the next window, you can choose the Spring Boot Starter dependencies you'd like to include in your project:
Spring Web
.Spring Data JPA
.Spring HATEOAS
.Spring Boot Starter Test
will usually be included by default.Search for and check the desired dependencies.
Next
.Review your project details and the selected dependencies. If everything looks good:
Finish
.STS will now generate the Spring Boot project structure and pull in the necessary dependencies from the Maven Central Repository or the specified repositories for Gradle.
In the Project Explorer or Package Explorer, you'll see your new project. It will have a standard Spring Boot structure. Inside the src/main/java
directory, you'll find the main application class marked with @SpringBootApplication
. This class serves as the entry point to your Spring Boot application.
Run As
> Spring Boot App
.Once running, if you added the Spring Web
dependency, your application would be accessible at http://localhost:8080
.
That's it! You've successfully set up a Spring Boot project in Spring Tool Suite. You can now start adding your business logic, controllers, services, and other components as required by your application.