No more complex XML configuration like old Java Spring — everything is auto-configured.
Just declare what you need in the pom.xml, and Spring Boot will handle the rest.
Works smoothly with MySQL, PostgreSQL, MongoDB, etc.
You can create endpoints like /add, /get, /delete in just a few lines.
| Feature | Spring (Old Way) | Spring Boot (Modern Way) |
|---|---|---|
| ⚙️ Setup | Everything manual (XML, server, dependencies) | Auto-configured and easy |
| 🚀 Server | You had to install Tomcat separately | Comes with embedded Tomcat |
| 📦 Dependencies | Add one by one | Comes pre-bundled with “starters” |
| 💡 For beginners | Complex | Super beginner-friendly |
| ⚡ Performance | Slower setup | Instant start with one command |
👉 In short: Spring Boot = Spring + Simplicity + Power
| Starter Name | 2025 Status | Purpose / Notes |
|---|---|---|
spring-boot-starter-web |
✅ Core | For building REST APIs or MVC web apps — includes Spring MVC, Tomcat, and Jackson (JSON) |
spring-boot-starter-data-jpa |
✅ Standard | For connecting to SQL databases using JPA (Hibernate) |
spring-boot-starter-security |
✅ Active | For authentication and authorization |
spring-boot-starter-test |
✅ Essential | Includes JUnit, Mockito, and Spring Test framework |
spring-boot-starter-validation |
✅ Used | For validating user inputs in APIs |
| Tool | Purpose | Download |
|---|---|---|
| Java JDK 17+ | Required for Spring Boot 3.x+ | Download Here |
| IntelliJ IDEA (Community) | Best IDE for Spring Boot | Download Here |
| MySQL + MySQL Workbench | Database | Download Here |
| Postman (optional) | Test your APIs | Download Here |
Go to 👉 https://start.spring.io
- Project: Maven
- Language: Java
- Spring Boot: Latest stable version (e.g., 3.5.x)
- Group:
com.todo - Artifact:
todolist - Dependencies:
- ✅ Spring Web
- ✅ Spring Data JPA
- ✅ MySQL Driver
- ✅ Spring Boot DevTools
Click Generate, download ZIP → Extract it → open in IntelliJ IDEA.
🪄 Download the Connector:
- Go to MySQL Connector/J
- Choose “Platform Independent (.zip)”
- Extract it → Find file
mysql-connector-j-9.x.x.jar
💡 Add to IntelliJ:
- Right-click your project → Open Module Settings
- Go to Libraries → + → Java
- Select the
.jarfile → Click Apply → OK
spring.datasource.url=jdbc:mysql://localhost:3306/todolist spring.datasource.username=root spring.datasource.password=yourpassword spring.jpa.hibernate.ddl-auto=update spring.jpa.show-sql=true
Model:
@Entity
public class Task {
@Id
@GeneratedValue(strategy = GenerationType.IDENTITY)
private Long id;
private String name;
private boolean completed;
// getters and setters
}| Annotation | Meaning |
|---|---|
@RestController |
Tells Spring this class handles HTTP requests (like API routes) |
@RequestMapping |
Sets base path for APIs (e.g., /tasks) |
@GetMapping |
Handles GET requests |
@PostMapping |
Handles POST requests |
@DeleteMapping |
Handles DELETE requests |
@Autowired |
Automatically injects dependencies |
@Entity |
Defines a database table |
@Id |
Marks the primary key |
@GeneratedValue |
Auto-increments IDs |
🧠 FAQs (Must Know for Beginners) ❓What is a dependency?
A dependency is like a “plugin” or “tool” your app needs to run — Spring Boot downloads it automatically via Maven.
❓What is Maven?
Maven is a project manager for Java. It installs and manages all your dependencies (listed in pom.xml).
❓What is pom.xml?
Think of it as your project’s recipe file — it tells Spring Boot which libraries to use.
❓Why XML?
Old Spring used XML to manually configure beans, servers, etc. Spring Boot made this automatic using annotations instead.
❓What is Spring Initializr?
A website that auto-generates your Spring Boot project with all basic setup done.
❓Why IntelliJ IDEA?
Because IntelliJ detects Spring Boot projects automatically, shows annotations, and makes debugging easy.
| Feature | Spring (Traditional) | Spring Boot (Modern) |
|---|---|---|
| 🚀 Setup Time | 30+ minutes | 2 minutes |
| ⚙️ Configuration | Manual XML/Java config | Auto-configured |
| 🖥️ Server Setup | Manual Tomcat installation | Embedded Tomcat included |
| 📦 Dependencies | Add one by one | Starters bundle everything |
| 🎯 Beginner Friendly | ❌ Complex | ✅ Super Easy |
| Tool | Purpose | Download |
|---|---|---|
| Java JDK 17+ | Runtime Environment | Download Here |
| IntelliJ IDEA | Best IDE for Spring Boot | Download Here |
| MySQL + Workbench | Database & GUI Tool | Download Here |
| Postman | API Testing | Download Here |
# Database Configuration
spring.datasource.url=jdbc:mysql://localhost:3306/todolist
spring.datasource.username=root
spring.datasource.password=yourpassword
# JPA Configuration
spring.jpa.hibernate.ddl-auto=update
spring.jpa.show-sql=true
spring.jpa.properties.hibernate.format_sql=true
# Server Configuration
server.port=8080
spring.application.name=todo-app
# Logging
logging.level.com.todo=DEBUG
logging.level.org.hibernate.SQL=DEBUG
| Annotation | Purpose | Example |
|---|---|---|
@SpringBootApplication | Main application entry point | ```java @SpringBootApplication public class App { public static void main(String[] args) { SpringApplication.run(App.class, args); } } ``` |
@RestController | API controller (returns JSON) | ```java @RestController @RequestMapping("/api") public class TaskController { @GetMapping("/tasks") public List getTasks() { return taskService.getAllTasks(); } } ``` |
@Service | Business logic layer | ```java @Service public class TaskService { // Business methods here } ``` |
@Repository | Data access layer | ```java @Repository public interface TaskRepository extends JpaRepository { } ``` |
@Entity | Database table mapping | ```java @Entity public class Task { @Id private Long id; private String title; } ``` |
@Autowired | Dependency injection | ```java @Autowired private TaskRepository taskRepository; ``` |
| Plugin | Purpose | Installation |
|---|---|---|
| Lombok | Reduces boilerplate code | Settings → Plugins → Lombok |
| Spring Boot Assistant | Enhanced Spring support | Marketplace → "Spring Boot" |
| Rainbow Brackets | Colorful bracket matching | Marketplace → "Rainbow Brackets" |
| GitToolBox | Git enhancements | Marketplace → "GitToolBox" |
# Run application
mvn spring-boot:run
# Run tests
mvn test
# Clean and build
mvn clean install
# Create executable JAR
mvn clean package
# Run with specific profile
mvn spring-boot:run -Dspring-boot.run.profiles=dev
| Command | Description |
|---|---|
mvn spring-boot:run |
Run the app |
mvn clean install |
Clean and rebuild |
Ctrl + Shift + F10 |
Run current class in IntelliJ |
Ctrl + Space |
IntelliJ autocomplete |