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.
Add your answer
Loading...

Leave a comment

Your email address will not be published. Required fields are marked *