To conditionally apply an auto-configuration based on the value of a configuration property, the _____ annotation is used in Spring Boot.
- @Autowired
- @ConditionalOnClass
- @ConditionalOnConfiguration
- @ConditionalOnProperty
In Spring Boot, the "@ConditionalOnProperty" annotation is used to conditionally apply an auto-configuration based on the value of a configuration property. This allows developers to customize the application's behavior depending on the configuration values, making it a powerful tool for managing application behavior in different environments or scenarios.
Loading...
Related Quiz
- How can parameterized tests be created using JUnit?
- In Spring Boot, the _____ annotation can be used to define which beans should be registered in the context based on a conditional check.
- To inject mock objects into the tested object in a Spring Boot unit test, the _____ annotation is used with Mockito.
- In a Spring Security application, you need to implement a feature where the users' passwords must be rotated every 30 days. How would you approach implementing this feature while maintaining a high level of security?
- In a Spring Boot test, how can you override the properties defined in the application.properties file?