What Is Spring Boot in Java?
Spring Boot is a framework built on top of the Spring ecosystem that lets you create a production-ready Java web application with minimal configuration. It provides embedded servers, sensible defaults, auto-configuration and a starter dependency system β you write business logic, not boilerplate.
A complete REST API in 20 lines
@SpringBootApplication
public class App {
public static void main(String[] args) {
SpringApplication.run(App.class, args);
}
}
@RestController
@RequestMapping("/api/users")
public class UserController {
@GetMapping("/{id}")
public User getUser(@PathVariable long id) {
return new User(id, "Ada Lovelace");
}
record User(long id, String name) {}
}
Run ./mvnw spring-boot:run and GET /api/users/1 returns {"id":1,"name":"Ada Lovelace"}. Spring Boot starts an embedded Tomcat, sets up Jackson for JSON serialisation, wires the controller, and handles HTTP routing β all from the @SpringBootApplication annotation and the starter dependencies in your pom.xml.
Key concepts
Auto-configuration: Spring Boot detects what is on the classpath and configures beans automatically. Add the JDBC starter? A DataSource bean is configured from your application.properties. Add the security starter? HTTP Basic Auth is applied by default.
Starter dependencies: Starters are curated dependency bundles. spring-boot-starter-web pulls in Spring MVC, embedded Tomcat, Jackson and the logging stack in one line. No version conflicts to manage β the Spring Boot BOM manages them.
Embedded server: Your app is a self-contained JAR with Tomcat (or Jetty, Undertow) inside. Deploy with java -jar app.jar β no WAR files, no application server to configure separately.
Dependency injection: Spring's IoC container wires your beans (@Service, @Repository, @Component) together automatically. You declare what you need, Spring creates and injects it.
Typical Spring Boot project structure
src/main/java/com/example/
βββ App.java @SpringBootApplication
βββ controller/
β βββ OrderController.java @RestController
βββ service/
β βββ OrderService.java @Service
βββ repository/
βββ OrderRepository.java @Repository (Spring Data JPA)
Common starters
| Starter | What it adds |
|---|---|
spring-boot-starter-web | REST APIs, Spring MVC, embedded Tomcat |
spring-boot-starter-data-jpa | JPA/Hibernate, Spring Data repositories |
spring-boot-starter-security | Authentication, authorisation, CSRF protection |
spring-boot-starter-test | JUnit 5, Mockito, AssertJ, MockMvc |
spring-boot-starter-actuator | Health checks, metrics, /actuator endpoints |
Spring Boot vs plain Spring
Spring Framework (the base) is highly configurable but verbose β you manually define beans, configure the dispatcher servlet, set up the transaction manager. Spring Boot is Spring Framework plus opinionated defaults. Most teams use Spring Boot unless they have very unusual configuration requirements.