Spring Framework Tutorial
Software Setup and Configuration (STS/Eclipse/IntelliJ)
Core Spring
Spring Annotations
Spring Data
Spring JDBC
Spring Security
Creating and setting up a Spring Boot project in Eclipse (or the Spring Tool Suite, an Eclipse-based IDE designed for Spring development) is straightforward. Here's a step-by-step guide:
If you're using plain Eclipse IDE and not the Spring Tool Suite (STS), you can install the Spring Tools plugin to get Spring Boot project templates:
Help
> Eclipse Marketplace
.Spring Tools
.Install
for the Spring Tools 4
(or the latest version available).Go to File
> New
> Spring Starter Project
. If you don't see this option, you might need to choose File
> New
> Other...
and then find Spring
> Spring Starter Project
.
In the New Spring Starter Project
dialog, fill in the details:
com.example
.Click Next
.
In the next dialog, you can search and select Spring Boot Starter dependencies that you want to add to your project:
For a basic web application, you might choose Spring Web Starter
.
If you plan to use a database, you might select Spring Data JPA
and a database connection pool like HikariCP
.
For testing, you could select Spring Boot Starter Test
.
Once you've chosen your dependencies, click Next
.
Finish
.If you chose Maven or Gradle, Eclipse would automatically start the initial build process, pulling in the necessary dependencies from the Maven Central Repository or the specified repositories for Gradle.
Your project will be created with a standard Spring Boot structure. In the src/main/java
directory, you'll find a main application class with the @SpringBootApplication
annotation. This class is the entry point for your Spring Boot application.
public static void main(String[] args)
method.Run As
> Java Application
.If you've added the Spring Web Starter
dependency, you can now access your application at http://localhost:8080
.
That's it! You've successfully set up a Spring Boot project in Eclipse. Adjust configurations, add code, and expand your application as needed.