Which annotation is used in Spring Boot to conditionally enable or disable certain parts of auto-configuration based on the presence of specific properties?
- @ConditionalOnProperty
- @EnableAutoConfiguration
- @ConditionalOnClass
- @Configuration
In Spring Boot, the @ConditionalOnProperty annotation is used to conditionally enable or disable certain parts of auto-configuration based on the presence or absence of specific properties in the application.properties file. This provides fine-grained control over which auto-configuration options are activated based on the application's configuration. The other annotations serve different purposes in Spring Boot.
Loading...
Related Quiz
- In a Spring Boot application, how can you specify that a method parameter should be bound to a web request parameter?
- You notice that a Spring Boot application is experiencing high latency. How would you go about identifying and resolving the performance bottlenecks in the application?
- For a service to register itself with Eureka, it must have the _____ annotation in its main application class.
- When unit testing Spring Boot applications, how can you mock the behavior of methods in a class?
- In a Spring Boot application, the _____ annotation is used to demarcate transaction boundaries.