How can you ensure that a Spring Boot application does not interact with external systems during integration testing?
- Mock external system responses
- Disable external system communication
- Use a test-specific profile
- Use @SpringBootTest(webEnvironment = SpringBootTest.WebEnvironment.NONE)
To ensure that a Spring Boot application does not interact with external systems during integration testing, you can use the @SpringBootTest annotation with the webEnvironment set to SpringBootTest.WebEnvironment.NONE. This avoids starting a real HTTP server, preventing external communication. The other options do not directly address this issue.
Loading...
Related Quiz
- How does the @Controller annotation interact with the view in a traditional Spring MVC application?
- How can you restrict access to specific HTTP methods in Spring Security?
- To perform integration testing in Spring Boot, the _____ annotation is used to enable full application context loading.
- In OAuth2, what is the purpose of the Refresh Token?
- For a service to register itself with Eureka, it must have the _____ annotation in its main application class.