In Spring Boot, how do you configure the TestRestTemplate to work with a specific profile during integration testing?
- Use @ActiveProfiles annotation
- Use @SpringBootTest with webEnvironment attribute
- Use @ContextConfiguration with locations attribute
- Use @AutoConfigureTestDatabase annotation
To configure the TestRestTemplate to work with a specific profile during integration testing, you can use the @ActiveProfiles annotation. This allows you to specify which application profile to use when running the tests. The other options do not directly configure the TestRestTemplate for a specific profile.
Loading...
Related Quiz
- Imagine you are starting a new Spring Boot project where you need to support both web applications and RESTful APIs. How would you set up the project to accommodate both requirements effectively?
- In a Spring Security enabled project, which method is used to configure HTTP security?
- In reactive programming with Spring Boot, how can you handle errors in a reactive stream?
- When unit testing Spring Boot applications, how can you mock the behavior of methods in a class?
- To apply data migration scripts in Spring Boot, you can use tools like _____ or _____.