Why this matters
- "Spring" and "Spring Boot" are not interchangeable — interviews and job postings use both, and conflating them signals shallow knowledge.
- The ecosystem has distinct projects (MVC, Data, Security) that Boot activates via starters; knowing the map helps you find documentation quickly.
- Inversion of control is the architectural idea behind every
@Autowiredand@Beanin the BookStore API.
The Spring portfolio
Projects you will touch in BookStore
- Spring Framework — Core IoC container, AOP, transaction abstraction, and MVC web layer.
- Spring Boot — Auto-configuration, embedded server, production-ready defaults, and the starter ecosystem.
- Spring Data JPA — Repository abstraction over Hibernate for Book and Author entities.
- Spring Security — Authentication, authorization, and the filter chain protecting
/api/**. - Springdoc OpenAPI — Generates Swagger UI from your controller annotations.
Inversion of control explained
In a traditional BookStore app you might write:
public class BookController {
private final BookService bookService = new BookService(
new JdbcBookRepository(new DataSource(...))
);
}
Every class constructs its own dependencies. Changing the repository implementation means editing every caller.
Spring inverts this: the container creates objects and injects dependencies. You declare what you need; Spring figures out how to provide it.
@RestController
public class BookController {
private final BookService bookService;
public BookController(BookService bookService) {
this.bookService = bookService; // injected by Spring
}
}
The controller never calls new BookService(). The container does at startup.
ApplicationContext: the heart of Spring
The ApplicationContext is a registry of beans — objects Spring manages. At startup it:
Container startup steps
- Scans for
@Component,@Service,@Repository,@Controller. - Reads
@Configurationclasses and@Beanmethods. - Resolves constructor dependencies and creates instances.
- Applies
@PostConstructcallbacks and registers shutdown hooks.
For BookStore, a single context holds one BookService, one BookRepository, and one DataSource — shared across all requests.
Why Boot exists
Plain Spring required extensive XML or Java configuration:
@Configuration
public class WebConfig {
@Bean
public DispatcherServlet dispatcherServlet() { ... }
@Bean
public DataSource dataSource() { ... }
// dozens more beans
}
Boot's auto-configuration detects classpath contents and configures beans conditionally. Add spring-boot-starter-data-jpa and a DataSource appears when application.yml has a spring.datasource.url.
Spring vs Spring Boot responsibilities
| Aspect | Spring Framework | Spring Boot |
|---|---|---|
| Dependency injection | Yes | Uses Framework |
| MVC mapping | Yes | Auto-registers DispatcherServlet |
| Embedded Tomcat | No | Yes |
| Externalised config | Basic support | application.yml, profiles, @ConfigurationProperties |
| Production metrics | Manual setup | Actuator starters |
Dependency injection
Spring FrameworkYesSpring BootUses FrameworkMVC mapping
Spring FrameworkYesSpring BootAuto-registers DispatcherServletEmbedded Tomcat
Spring FrameworkNoSpring BootYesExternalised config
Spring FrameworkBasic supportSpring Bootapplication.yml, profiles, @ConfigurationPropertiesProduction metrics
Spring FrameworkManual setupSpring BootActuator starters
Boot does not replace Spring — it configures it.
The starter pattern preview
Instead of listing twenty JAR coordinates, Boot offers curated bundles:
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-web</artifactId>
</dependency>
One dependency brings Tomcat, Jackson, Spring MVC, and validation. The starters module covers this in depth.
Jakarta EE namespace shift
Spring Boot 3.x runs on Jakarta EE 9+ packages (jakarta.servlet, jakarta.persistence). Code using javax.* imports from older tutorials will not compile. When reading Stack Overflow answers, check the Spring Boot version.
Ecosystem versioning
Spring Boot 3.4.x aligns with Spring Framework 6.x and requires Java 17+. The Spring release train publishes compatible versions together. Stick to the BOM — mixing manual version overrides causes subtle runtime failures.
Where BookStore fits
Your learning path builds the BookStore API layer by layer: web foundations → IoC wiring → Boot auto-config → REST endpoints → JPA persistence → cross-cutting concerns → security. Each module adds one Spring project to the same application.
@SpringBootApplication
public class BookStoreApplication {
public static void main(String[] args) {
SpringApplication.run(BookStoreApplication.class, args);
}
}
That single annotation bootstraps the entire ecosystem for your app.
Quick recall
Everything you need if you only revisit this box.
- Spring Framework provides IoC, MVC, AOP, and transactions; Boot auto-configures them.
- Inversion of control means the container creates and wires objects — you declare dependencies, not construction.
ApplicationContextis the bean registry created at startup and shared across requests.- Boot 3.x uses Jakarta (
jakarta.*) packages and requires Java 17+. - Starters bundle related dependencies; the BOM keeps versions compatible.
- BookStore grows through the track by adding one Spring concern per module.
Test yourself
Answer these before moving on — recall is what makes it stick.