To specify that a bean should only be created under a specific condition, you would use the _____ annotation in Spring Boot.
- @ConditionalBean
- @ConditionalOnProperty
- @ConditionalOnClass
- @ConditionalOnCondition
In Spring Boot, the "@ConditionalOnProperty" annotation is used to specify that a bean should be created only under a specific condition based on the values of specified properties. This is a powerful feature that allows developers to control bean creation based on property values, making the application's configuration more flexible and adaptable. The other options are not the correct annotations for this purpose.
Loading...
Related Quiz
- How does the @ConditionalOnClass annotation influence the application of auto-configuration in Spring Boot?
- What is the primary purpose of using TestContainers in Spring Boot?
- The _____ in Spring Security can be used to execute some logic when a user logs in successfully.
- In Mockito, the _____ method can be used to stub a return value for a method call.
- How can you profile a production Spring Boot application without affecting its performance significantly?