Adding @ConditionalOnProperty
negation would be useful.
Use case:
@ConditionalOnProperty(name = "spring.cache.type", notHavingValue = "NONE")
or
@ConditionalOnProperty(name = "spring.cache.type", havingValue = "NONE", negated = true)
to match when cache is enabled.
Comment From: snicoll
Thanks for the suggestion but this was already raised on a few occasions and declined. #4938 has some more context as why we're not keen to do that.
Back to your example, the example above would not give you a confident result that cache is enabled as you may have this property in this environment and configure the CacheManager
yourself.