In which scenario would you use the @ConditionalOnProperty annotation in Auto Configuration?
- To control the loading of properties files during application startup.
- To declare properties that can be conditionally enabled or disabled.
- To define a condition that must be met for a bean to be registered.
- To specify which beans should be injected based on the active Spring profiles.
The @ConditionalOnProperty annotation is used in Auto Configuration to define a condition that must be met for a bean to be registered. It allows you to conditionally enable or disable the registration of a bean based on the presence and value of specified properties in the application.properties file.
Loading...
Related Quiz
- Which of the following annotations is specifically used for injecting dependencies on setter methods?
- To externalize configuration properties in Spring Boot, the _____ annotation can be used on a configuration properties class.
- In a distributed environment, using Spring Boot, cache synchronization can be achieved efficiently through _____.
- What is the role of the JdbcTemplate class in Spring Boot, and how is it different from using JPA?
- The @Autowired annotation in Spring can be used to autowire bean on the _____