In Spring Boot, the _____ annotation can be used to define which beans should be registered in the context based on a conditional check.
- @ConditionalOnProperty
- @ConditionalOnClass
- @ConditionalOnBean
- @Conditional
The "@ConditionalOnProperty" annotation in Spring Boot allows you to define conditions under which a bean should be registered in the application context. It checks the specified property and registers the bean if the condition is met. The other options, such as "@ConditionalOnClass," "@ConditionalOnBean," and "@Conditional," serve different conditional registration purposes based on different conditions or criteria.
Loading...
Related Quiz
- For advanced scenarios in service discovery, such as region isolation, the Spring Cloud component ____ can be configured along with Eureka.
- You notice that a Spring Boot application is not evicting cache entries as expected, leading to outdated data being served. How would you diagnose and resolve this issue?
- What is the primary build tool used for Spring Boot projects by default when generating a project using start.spring.io?
- How can you handle exceptions globally across multiple controllers in a Spring Boot application?
- Which annotation is used to define a bean that holds the business logic in a Spring Boot application?