I have a class that requires a couple of configuration properties to be set in order to instantiate a service, and also an enabled flag to turn off that autoconfig. While I'd like a simpler setup (#2312), in the meantime I'm trying to use @ConditionalOnProperty to check whether the properties are available. Since enabled defaults to true, I want it to matchIfMissing, but obviously not the other actual configuration properties.

However, matchIfMissing (and havingValue) apply to all of the properties in the annotation. I would like to be able to repeat the annotation to specify multiple property names that have different presence/value matching parameters.

Comment From: philwebb

Have you seen AnyNestedCondition? It's obviously not as nice as @Repeatable, but it's at least there for 1.2.

Comment From: chrylis

In this case, I'd need an AllNestedCondition.

Comment From: philwebb

Ahh OK. Good point. We do have a PR for that but it won't be looked at until 1.3 (see #2400). I like the repeatable idea as well.

Comment From: benneq

Should this be a logical OR or an AND?

Comment From: philwebb

@benneq My take is that it should be a logical and so that it works in the same way as @Conditional.value()

Comment From: derTobsch

It would be nice if this feature would come soon. It is much more easier to use multiple @ConditionalOnProperty

Comment From: caneraydinbey

+1

Comment From: sta-szek

vote vote +1

Comment From: Hronom

obviously +1

Comment From: snicoll

This requires a core framework change that still needs to be discussed. I've raised SPR-17207.

Comment From: gorodum

+1

Comment From: philwebb

We may be able to do this without needing the Framework change.