Which annotation is used to test only the web layer in a Spring Boot application?
- @ComponentTest
- @ServiceTest
- @SpringBootTest
- @WebMvcTest
The @WebMvcTest annotation is used to test the web layer of a Spring Boot application. It focuses on setting up the application context with only the necessary components for testing the web layer, such as controllers and web-related beans.
Loading...
Related Quiz
- The _____ annotation in Spring Boot is used to test only the web layer by disabling full auto-configuration and applying only relevant web configurations.
- In Spring Security, what is the significance of configuring a global method security, and how does it differ from standard method security configurations?
- When using @Secured and @PreAuthorize annotations, what is the primary configuration attribute that needs to be enabled?
- Which of the following annotations is used to handle exceptions globally across the whole application in Spring Boot?
- How can you configure multiple DataSources in a Spring Boot application?