Spring Framework — the core IoC container and dependency injection framework. Spring Boot — an opinionated layer on top of Spring that simplifies setup with auto-configuration, embedded servers, and starter dependencies.
Spring Boot advantages:
1// Spring Boot application2@SpringBootApplication // Combines: @Configuration + @EnableAutoConfiguration + @ComponentScan3public class MyApp {4 public static void main(String[] args) {5 SpringApplication.run(MyApp.class, args);6 }7}89@RestController10class HelloController {11 @GetMapping("/hello")12 String hello() {13 return "Hello, World!";14 }15}1617// application.yml18server:19 port: 808020spring:21 datasource:22 url: jdbc:postgresql://localhost/mydb23 jpa:24 hibernate:25 ddl-auto: update
Key differences: