Spring Boot Words Explained: Bean, ApplicationContext, Auto-Configuration, DispatcherServlet
▶ Watch on YouTube & subscribe to The Stack Underflow
The Spring Boot lifecycle video uses a lot of words: bean, application context, auto-configuration, DispatcherServlet, proxy, readiness. This primer explains each one with a single example, a bookstore app answering GET /books/42, and one map that fills in as you go. It targets Spring Boot 4 and Spring Framework 7.
The one-line version: the ApplicationContext creates and wires your beans; Boot adds starters, auto-configuration and an embedded server; a request passes filters, then the DispatcherServlet, then your code through proxies; and “Started” is not “Ready”.
Last verified against the Spring Boot 4.1.1 and Spring Framework 7.0.9 reference documentation: 1 October 2026. The video’s definitions were checked on 29 September 2026 against the same versions; the version-specific ones (Boot 4 requires Framework 7, the starter rename, embedded servers and port, @Transactional defaults) were re-checked today.
One picture: a restaurant
Every word gets a peg from one picture, a restaurant. The pegs are analogies, memory aids, not definitions; the right-hand column is the real meaning, and the limits are covered in the sections below.
| Word | Memory peg (analogy) | What it actually is |
|---|---|---|
| Spring Framework vs Spring Boot | the kitchen kit vs the ready-to-open restaurant | The Framework is the foundation (container, Spring MVC, transactions). Boot is a separate project on top that adds starters, auto-configuration and an embedded server. Boot 4 requires Framework 7 |
| ApplicationContext | the manager | The Spring IoC container: it instantiates, configures and assembles the beans |
| Bean | hired staff | An object the container creates, assembles and manages. An object you create with new is not a bean |
| Dependency injection | tools handed over | A class declares what it needs (here, through its constructor) and the container supplies it |
@Component and stereotypes | job-title badges | @Component makes a bean; @Service, @Repository, @Controller also name its layer |
| Starters + auto-configuration | the fit-out package | A starter only brings libraries; auto-configuration adds default beans, and backs off when you define your own |
application.yaml + profiles | the settings board (weekday and weekend versions) | Settings outside the code; a profile is a named set of settings for one environment |
@ConfigurationProperties | a whole board section | Binds a group of settings, like bookstore.*, to a typed, validatable object |
| Embedded server vs WAR | food truck vs food hall | Boot runs Tomcat inside your JVM; a WAR is deployed into a separate servlet container |
| DispatcherServlet | the head waiter at the pass | Spring MVC’s front controller servlet: finds the handler and writes the result |
| Servlet filter | door security | Runs before the servlet (and on the way out); belongs to the servlet container |
| HandlerInterceptor | the head waiter’s check | Spring MVC’s hook around a chosen handler: preHandle, postHandle, afterCompletion |
| Controller / service | the waiter and the chef | HTTP in and out vs business logic |
@Transactional proxy | the tab supervisor | A proxy in front of the bean that starts or joins a transaction, then commits or rolls back |
| Entity | the ledger entry | A JPA class whose objects map to table rows |
| DAO vs repository | the stock clerk (you train vs the agency supplies) | A DAO is a class you write; a Spring Data repository is an interface Spring implements at run time |
| DTO | the plate as served | A plain object that only carries data, shaped for the API |
@PostConstruct / @PreDestroy | opening and closing checklists | Per-bean callbacks after injection and when the context closes |
| Started vs Ready | lights on vs doors open | Context refreshed vs runners finished and accepting traffic |
| Runners | prep before opening | Beans with one run method, called just before SpringApplication.run() completes |
| Liveness vs readiness | kitchen alive? vs seating guests? | Restart the app vs send it traffic now |
The container and its beans
The ApplicationContext is the IoC container. Inversion of control means your classes don’t create their collaborators; the container does. It’s often confused with BeanFactory, the basic container interface. ApplicationContext extends it and adds events, message resources and AOP integration.
A bean isn’t a special kind of class. The same class becomes a bean only when the container creates and manages the object.
With constructor injection, BookController’s constructor takes a BookService, and Spring passes in that bean. A class with a single constructor needs no @Autowired. The Spring team recommends constructor injection for required dependencies (immutable, never null). Field injection happens after construction, so an injected field isn’t set yet inside the constructor.
@RestController
class BookController {
private final BookService books;
BookController(BookService books) { this.books = books; } // one constructor: no @Autowired needed
}
Component scanning finds @Component classes and their specializations. @Repository adds behaviour on top of naming the layer: exception translation into Spring’s DataAccessException hierarchy (the peg’s “house language”). @RestController is @Controller plus @ResponseBody.
What Spring Boot adds
A starter is a dependency descriptor. In Boot 4, spring-boot-starter-webmvc (Spring MVC and Tomcat) replaces the deprecated spring-boot-starter-web. Starters only bring libraries. Auto-configuration then adds the beans you’d otherwise write, based on what’s on the class path, and backs off when you define your own: add your own DataSource bean and the default embedded database support backs away. Back-off is per condition, not all-or-nothing.
application.yaml (or .properties) holds settings outside the code; environment variables and command-line arguments can override it. A profile-specific file such as application-prod.yaml applies only when prod is active (spring.profiles.active). It’s the same jar with different settings. @Value injects one property at a time; @ConfigurationProperties binds a whole group into a typed object.
The webmvc starter brings embedded Tomcat, listening on port 8080 by default (Boot also supports embedded Jetty for servlet apps). Boot still supports traditional WAR deployment, but the lifecycle video covers only the executable jar. Tomcat is created in onRefresh() and binds its port in finishRefresh().
Following GET /books/42
client → Tomcat → servlet filters (Spring Security) → DispatcherServlet
→ HandlerInterceptor.preHandle → BookController → @Transactional proxy → BookService
→ BookRepository → SQL → Book entity → BookDto → JSON (Jackson)
Filter vs interceptor is the classic confusion. Filters belong to the servlet container and run before the DispatcherServlet, and again on the way out. They can change the request or answer by themselves. Spring Security is a chain of filters, so it can reply 401 or 403 before your controller is reached. Interceptors run inside the DispatcherServlet once the handler is chosen; if preHandle returns false, the handler isn’t called. For security, the Spring docs recommend Spring Security or the filter chain, not interceptors.
The controller deals with HTTP; the service holds business logic. Keeping HTTP out of the service is a design choice that lets other callers, such as a test, use it.
The proxy trap: because BookService is @Transactional, callers get a proxy. The proxy starts or joins a transaction (default propagation REQUIRED), calls the real method, then commits, or rolls back on a RuntimeException or Error. By default it does not roll back on checked exceptions. In the default proxy mode, only external calls through the proxy are intercepted, so a call between two methods of the same class starts no transaction.
Entity, repository, DTO
An entity is a JPA (Jakarta Persistence) concept, not a Spring one: a class annotated @Entity with an @Id primary key, each object mapping to one row. Boot’s JPA starter uses Hibernate. An entity isn’t a bean.
A DAO is a pattern, a class you write to hide data access. A Spring Data repository is an interface: BookRepository extends JpaRepository typed to Book and Long, and Spring Data creates a proxy implementation at run time. findById comes with it; findByTitle becomes a query derived from the method name.
A DTO carries data between layers. BookService copies the fields the client should see into a BookDto, and Spring MVC converts it to JSON with Jackson. Nothing forces you to use one; it lets you choose what the JSON contains.
Startup, shutdown and health
@PostConstructruns once per bean, after dependency injection;@PreDestroyruns when the context closes. Both come from Jakarta Annotations. They’re per bean, “as each is hired”, not when the app opens to traffic.ApplicationStartedEventis sent after the context is refreshed but before any runners.ApplicationReadyEventis sent after the runners, and right after it readiness switches toACCEPTING_TRAFFIC. Where the peg stops fitting: Tomcat’s port is already bound before “Started”.CommandLineRunnergets the arguments as aStringarray;ApplicationRunnergets anApplicationArgumentsobject.@Ordersets their order.- Actuator exposes the liveness and readiness health groups as
/actuator/health/livenessand/actuator/health/readiness. A broken liveness state means the platform should restart the app; a failing readiness state only stops traffic.
Pause & Prove
1. saveAll() in BookService calls this.save(), which is annotated @Transactional. Does save() start a transaction?
- A. Yes, the annotation is on the method. Tempting, but the annotation only works through the proxy.
- B. No: the call never passes through the proxy. ✓ Callers get the proxy;
this.save()is a self-invocation inside the target object, so no transaction starts. The chef calling their own station. - C. Only if
saveAll()is public. Visibility of the caller doesn’t route the call through the proxy. - D. Only if it throws. Rollback rules apply inside a transaction; there isn’t one here.
2. A request reaches a Spring MVC app. Which runs first? (Community poll)
- A servlet filter ✓ Filters belong to the servlet container and run before the DispatcherServlet.
- A HandlerInterceptor. Runs inside the DispatcherServlet, after the handler is chosen.
- Your controller. Runs after the filters, mapping and
preHandle. - The
@Transactionalproxy. Only when the controller calls the service.
3. Peg drill
Say the peg first: bean → hired staff · repository → the stock clerk · DTO → the plate as served.
Before / after this video
- Before: Port, Socket, Reverse Proxy, JVM, Pod, SIGTERM: Backend Words covers the web and runtime words this primer assumes.
- Next: What Spring Boot Actually Does After java -jar (Startup to Graceful Shutdown), where every word here appears in one state machine.
Sources
- Spring Boot System Requirements: Boot 4.1.1 requires Java 17+ and Spring Framework 7.0.9+ (re-checked 1 Oct 2026)
- Spring Boot, Build Systems (starters): starters,
webmvc= Spring MVC + Tomcat,webdeprecated, JPA starter uses Hibernate (re-checked 1 Oct 2026) - Spring Boot, Auto-configuration: configures from your jar dependencies; backs away for your own
DataSource(re-checked 1 Oct 2026) - Spring Boot, Externalized Configuration and Profiles: config sources, profile-specific files,
@Valuevs@ConfigurationProperties - Spring Boot, Servlet Web Applications: embedded Tomcat and Jetty, port 8080, servlet/filter beans registered, Jackson (re-checked 1 Oct 2026)
- Spring Boot, Traditional Deployment: WAR deployment still supported
- Spring Boot, SpringApplication: events order, runners, shutdown hook, availability states
- Spring Boot, Actuator Endpoints: health endpoint, liveness/readiness probe URLs
- Spring Framework, IoC Container, Container Overview, Dependency Injection, Classpath Scanning: beans, IoC, constructor injection, stereotypes
- Spring Framework, DispatcherServlet and Interception: front controller;
preHandle; interceptors not ideal for security (re-checked 1 Oct 2026) - Spring Framework, Using @Transactional: proxy mode, self-invocation,
REQUIRED, rollback on RuntimeException and Error (re-checked 1 Oct 2026) - Spring Security, Servlet Architecture: Security is based on servlet filters
- Spring Data JPA, Defining Repository Interfaces: repositories are interfaces
- Jakarta Servlet 6.1, Jakarta Persistence 3.2, Jakarta
@PostConstruct: servlet, filter, entity,@Id, PostConstruct - Martin Fowler, Data Transfer Object and Oracle, DAO pattern: DTO and DAO definitions
Change notes
- 1 Oct 2026: first published.
Not affiliated with or endorsed by VMware Broadcom (Spring). Spring is a trademark of Broadcom Inc. and/or its subsidiaries. Found a mistake? Tell us in the video’s comments and we’ll correct this page.
Found this useful? The deep version lives on YouTube — new breakdowns of how AI dev tools actually work, weekly.
Subscribe on YouTube →Prefer email? Get the free newsletter: one failure, traced step by step, about once a week.