Currently, Spring Boot provides the @ConditionalOnProperty annotation to conditionally load beans or configurations based on a single property. However, there is no built-in support for conditionally loading beans based on multiple properties
in a single annotation or use multiple annotations of it. This requires developers to write custom conditions.
Introduce a new annotation, @ConditionalOnProperties, that allows developers to specify multiple @ConditionalOnProperty conditions in a single annotation. This would simplify the configuration and improve readability. Now, developer will have the option to write single condition using @ConditionalOnProperty or use @ConditionalOnProperities like the mentioned:
@ConditionalOnProperties({
@ConditionalOnProperty(name = "property1", havingValue = "true", matchIfMissing = true),
@ConditionalOnProperty(name = "property2", havingValue = "false", matchIfMissing = true)
})
In spring boot we can add multiple with the same havingValue and matchIfMissing like this:
@ConditionalOnProperty(name = {"property1", "property2"}, matchIfMissing = true, havingValue = "false")