How can you customize the security configurations when performing integration testing with @SpringBootTest in Spring Boot?
- Use the @TestSecurity annotation to configure security settings for the test.
- Modify the application.properties file for the test environment.
- Implement a custom SecurityConfigurer class and annotate it with @TestSecurityConfig.
- Use the @SpringBootTest annotation to enable security configurations automatically.
When performing integration testing with @SpringBootTest, you can customize security configurations by implementing a custom SecurityConfigurer class and annotating it with @TestSecurityConfig. This allows you to provide specific security settings for testing scenarios. Options 1, 2, and 4 are not the standard approaches for customizing security configurations in integration tests.
Loading...
Related Quiz
- In a Spring Data JPA repository, which annotation is used to annotate a custom query when the derived query mechanism is not sufficient?
- Which annotation is used to disable full auto-configuration and instead apply only configuration relevant to JPA tests in Spring Boot?
- How would you design a Spring Cloud application to handle failovers and service unavailability, ensuring minimal impact on the user experience?
- To optimize the garbage collection in JVM for a Spring Boot application, developers can configure the _____ option in JVM parameters.
- What is the role of the @WebMvcTest annotation in Spring Boot testing?