What is Spring Boot, and how does it differ from the core Spring Framework?
Quick Answer
Spring Framework is the underlying IoC container and set of modules (Core, MVC, Data, Security, ...) — powerful but historically requiring substantial manual configuration (XML or Java config) to wire together. Spring Boot is built on top of Spring, adding auto-configuration (sensible defaults inferred from what's on the classpath), starter dependencies (curated dependency bundles), an embedded servlet container, and production-ready features (Actuator) — so you get a working, opinionated application with minimal explicit configuration, while still being able to override any default.
Detailed Answer
The Spring Framework is the underlying platform: the IoC container, the AOP module, Spring MVC, Spring Data, Spring Security, and so on. It's powerful and flexible, but historically required a fair amount of manual configuration — declaring beans explicitly, wiring a DispatcherServlet, configuring a data source, choosing and configuring a servlet container — even for a simple application.
Spring Boot is built on top of Spring, adding an opinionated, convention-over-configuration layer:
- Auto-configuration: Spring Boot inspects what's on the classpath (and what beans you've already defined) and automatically configures sensible defaults — e.g., if
spring-boot-starter-weband an embedded Tomcat are present, it auto-configures aDispatcherServletand starts an embedded web server, with no explicit XML/Java config required. - Starter dependencies: curated, versioned dependency bundles (
spring-boot-starter-web,spring-boot-starter-data-jpa) that pull in a coherent, tested set of libraries for a given purpose, instead of manually assembling and version-matching individual JARs. - Embedded servers: Tomcat/Jetty/Undertow bundled directly into the runnable JAR — no separate application server installation/deployment needed.
- Production-ready features: Actuator (health checks, metrics, monitoring endpoints) out of the box.
@SpringBootApplication // Spring Boot's entry point — enables auto-configuration, component scanning, and config
public class MyApp {
public static void main(String[] args) {
SpringApplication.run(MyApp.class, args); // starts an embedded server, wires everything
}
}
In one line: Spring Framework is the engine; Spring Boot is the opinionated, batteries-included way of assembling and running that engine with minimal ceremony — every auto-configured default can still be overridden explicitly when the default doesn't fit.