@SpringBootTest
@SpringBootTest is a Spring Boot testing annotation that loads an application context with Spring Boot support for integration testing.
Testing Spring Boot Applications
@SpringBootTest is a Spring testing annotation that loads an application context for integration testing of a Spring Boot application.
- How it is used
- Loads a Spring Boot application for integration tests that exercise collaborating components.
- How deep it goes
- Explains lifecycle and injection through JUnit and TestContext, then identifies configuration attributes without tracing their full implementation.
- Examples
- Uses an empty startup test, a configured application test, and an HTTP endpoint assertion.
- What you can do after
- Apply it via @SpringBootTest to configure integration tests and choose between mock MVC and a real server.
Read how Testing Spring Boot Applications explains @SpringBootTest →
Spring Start Here, Second Edition
@SpringBootTest is a Spring Boot test annotation that loads an application context for integration testing.
- How it is used
- Starts the Spring application context so integration tests can use application-managed beans and configuration.
- How deep it goes
- Defines its context-loading role and demonstrates it in a MockMvc controller test, without detailing annotation options.
- Examples
- Demonstrates a money transfer endpoint test using MockMvc and a mocked AccountRepository.
- What you can do after
- Apply it with MockMvc to test a web endpoint through the Spring context and verify its response.
Read how Spring Start Here, Second Edition explains @SpringBootTest →
Spring in Action, Sixth Edition
@SpringBootTest is a Spring Boot testing annotation that loads an application context with Spring Boot test support.
- How it is used
- Checks that a Spring application context can load successfully during automated JUnit testing.
- How deep it goes
- Explains context loading and composite annotation behavior, but defers the annotation's additional capabilities.
- Examples
- Uses TacoCloudApplicationTests with an empty contextLoads test and the ./mvnw test command.
- What you can do after
- Diagnose configuration changes that prevent the Spring application context from being created.
Read how Spring in Action, Sixth Edition explains @SpringBootTest →
Spring Security in Action, Second Edition
@SpringBootTest is a Spring Boot test annotation that loads an application context for integration testing.
- How it is used
- Manages the Spring context for integration-style security tests that exercise endpoint behavior.
- How deep it goes
- Defines context management and endpoint-test integration, but does not detail Spring context internals.
- Examples
- Uses MainTests, MockMvc calls to /hello, and 401 or 200 status assertions.
- What you can do after
- Evaluate endpoint authorization by running MockMvc requests inside a managed Spring context.
Read how Spring Security in Action, Second Edition explains @SpringBootTest →
What to know first
- integration testAn integration test evaluates whether multiple software components, or a component and an external dependency, interact and behave correctly together.
Related concepts
- SpringExtensionuses · SpringExtension is a JUnit Jupiter extension that integrates Spring's test-context support with JUnit 5 tests.
- application contextconfigures · A Spring application context is a container that creates, configures, and manages application components and their dependencies, and provides access to them.
- @ApplicationModuleTestequivalent to · @ApplicationModuleTest is a Spring Modulith annotation that loads the beans and configuration of a selected application module for testing.
- configurationconfigures · Configuration is a set of settings or structural choices that specifies how a system, application, or component is organized or operates.
- integration testconfigures · An integration test evaluates whether multiple software components, or a component and an external dependency, interact and behave correctly together.
Questions about @SpringBootTest
What is @SpringBootTest?
@SpringBootTest is a Spring Boot testing annotation that loads an application context with Spring Boot support for integration testing.
Which Manning books explain @SpringBootTest?
Testing Spring Boot Applications, Spring Start Here, Second Edition, Spring in Action, Sixth Edition and Spring Security in Action, Second Edition.
What should I know before learning @SpringBootTest?
Manning books that teach @SpringBootTest usually introduce integration test first.
These guides are generated from the text of Manning books by Manning's knowledge graph and link to the sections they draw on. The full books are available on liveBook and at manning.com.



