How can you configure profiles in Spring Boot to optimize configuration loading during testing?
- Use spring.profiles.active property in application.properties file.
- Use @Profile annotation in test classes.
- Profiles cannot be optimized for testing.
- Set spring.profiles.default in application.yml.
In Spring Boot, you can optimize configuration loading during testing by using the @Profile annotation in test classes. This allows you to specify which profiles should be active during testing, overriding the application's default profile. Option (1) is not the preferred way for testing. Option (4) is incorrect as it is used to set the default profile, not for testing purposes. Option (3) is incorrect; profiles can indeed be optimized for testing.
Loading...
Related Quiz
- The JVM option ________ can be optimized to allocate more memory to a Spring Boot application.
- How can you handle scenarios where both @RequestBody and @ResponseBody are required in a controller method in Spring Boot?
- What is the main goal of Reactive Streams in Spring Boot?
- How can you customize the response message sent to the client when a validation error occurs?
- Which of the following is NOT a benefit of implementing caching in a Spring Boot application?