In Spring Boot, which annotation is used to conditionally enable caching only when a certain property is set?
- @Cacheable
- @ConditionalCache
- @ConditionalOnProperty("spring.cache.enabled")
- @EnableCaching
In Spring Boot, you can conditionally enable caching by using the @ConditionalOnProperty annotation with the property name as "spring.cache.enabled." This annotation allows caching to be enabled only when the specified property is set to true. The other annotations do not provide conditional caching based on a property.
Loading...
Related Quiz
- Which of the following is true about the deleteById method of a JpaRepository?
- You are developing a Spring Boot application which has conflicting auto-configuration classes. How would you analyze and resolve these conflicts to ensure the correct configurations are applied?
- How can you customize the token endpoint response of an OAuth2 Authorization Server in Spring Boot?
- What is the primary use of WebFlux in a Spring Boot application?
- The @Autowired annotation in Spring can be used to autowire bean on the _____