Spring Boot Setup
Setting up a Spring Boot project takes under five minutes. You use a tool called Spring Initializr to generate a ready-to-run project, then open it in your IDE.
What You Need Before Starting
- Java JDK 17 or higher — Spring Boot 3.x requires Java 17+
- Maven or Gradle — build tools that manage dependencies
- IDE — IntelliJ IDEA (recommended), Eclipse, or VS Code
- Internet connection — to download dependencies
Check Your Java Version
Open a terminal and run:
java -version
You should see version 17 or above. If not, download the latest JDK from adoptium.net.
Step 1 — Generate a Project with Spring Initializr
Go to start.spring.io in your browser. This website generates a project skeleton for you.
┌────────────────────────────────────────────┐ │ Spring Initializr │ │ │ │ Project: Maven │ │ Language: Java │ │ Spring Boot: 3.x (latest stable) │ │ │ │ Group: com.estudy247 │ │ Artifact: demo │ │ Packaging: Jar │ │ Java: 17 │ │ │ │ Dependencies: Spring Web │ │ │ │ [ Generate ] │ └────────────────────────────────────────────┘
Click Generate. A ZIP file downloads to your computer.
Step 2 — Open the Project in Your IDE
- Unzip the downloaded file
- Open IntelliJ IDEA
- Click File → Open and select the unzipped folder
- IntelliJ detects it as a Maven project and downloads all dependencies automatically
Step 3 — Run the Application
Open the main class — it is named DemoApplication.java. Click the green Run button or press Shift + F10.
You will see output in the console ending with:
Tomcat started on port 8080 Started DemoApplication in 1.4 seconds
Your Spring Boot app is running on http://localhost:8080.
The Main Class Explained
@SpringBootApplication ← Magic annotation that enables everything
public class DemoApplication {
public static void main(String[] args) {
SpringApplication.run(DemoApplication.class, args); ← Starts the app
}
}
@SpringBootApplication combines three annotations into one:
@SpringBootApplication
│
├── @Configuration ← This class defines beans
├── @EnableAutoConfiguration ← Auto-configure based on libraries present
└── @ComponentScan ← Scan this package for components
Understanding pom.xml
Maven uses a file called pom.xml to manage dependencies. Your generated file includes:
<parent>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-parent</artifactId>
<version>3.x.x</version> ← Spring Boot version
</parent>
<dependencies>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-web</artifactId>
<!-- No version needed — parent manages it -->
</dependency>
</dependencies>
The parent POM manages all version numbers. You add starters and Spring Boot picks compatible versions automatically.
Common Starters and What They Include
Starter Name What It Adds ──────────────────────────── ────────────────────────────── spring-boot-starter-web Tomcat, Spring MVC, JSON support spring-boot-starter-data-jpa Hibernate, Spring Data, JPA spring-boot-starter-security Spring Security, auth filters spring-boot-starter-test JUnit, Mockito, AssertJ spring-boot-starter-validation Bean Validation (Hibernate Validator)
Summary
- Use start.spring.io to generate a Spring Boot project in seconds
- Java 17+ and Maven are the minimum requirements for Spring Boot 3.x
@SpringBootApplicationstarts auto-configuration and component scanning- Starters bundle all related dependencies so you add just one line
- The embedded Tomcat server starts on port 8080 by default
