application context
The running Spring container: the object that holds every bean for an application and manages their creation and shutdown.
In more detail
SpringApplication.run creates the context at startup; when it closes, destruction callbacks run. Tests can start a full context or a small slice of it. Changing profiles changes what the context contains, which is why a profile switch needs a restart.
Related terms
- Spring bean — An object that the Spring container creates, configures and manages, and can inject into other beans.
- inversion of control — A design in which a piece of code gives up control of some decisions, such as how its dependencies are created or what it renders, to the code around it.
- @SpringBootApplication — The annotation on a Spring Boot main class that switches on component scanning, auto-configuration and configuration declarations in one go.
- test slice — A Spring Boot test that starts only one layer of the application, such as the web layer with @WebMvcTest, to stay fast.
Taught in
- Dependency Injection And The IoC Container — Modern Java: Virtual Threads & High-Throughput Services
- Spring Boot Auto Configuration — Modern Java: Virtual Threads & High-Throughput Services
- The Spring Bean Lifecycle — Modern Java: Virtual Threads & High-Throughput Services
- Testing APIs With MockMvc — Modern Java: Virtual Threads & High-Throughput Services