Skip to content

Make @ConditionalOnProperty and @ConditionalOnBooleanProperty @Repeatable #2541

New issue

Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? # to your account

Closed
chrylis opened this issue Feb 24, 2015 · 12 comments
Closed
Assignees
Labels
type: enhancement A general enhancement
Milestone

Comments

@chrylis
Copy link
Contributor

chrylis commented Feb 24, 2015

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.

@philwebb
Copy link
Member

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

@philwebb philwebb added the type: enhancement A general enhancement label Feb 24, 2015
@chrylis
Copy link
Contributor Author

chrylis commented Feb 24, 2015

In this case, I'd need an AllNestedCondition.

@philwebb
Copy link
Member

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.

@philwebb philwebb added this to the 1.3.0 milestone Feb 24, 2015
@benneq
Copy link

benneq commented Feb 24, 2015

Should this be a logical OR or an AND?

@philwebb
Copy link
Member

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

@philwebb philwebb modified the milestones: 1.4.0, 1.3.0.RC1 Jul 10, 2015
@philwebb philwebb removed this from the 1.4.0 milestone Jan 7, 2016
@derTobsch
Copy link

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

@philwebb philwebb added the status: ideal-for-contribution An issue that a contributor can help us with label Apr 11, 2016
@caneraydinbey
Copy link

+1

@sta-szek
Copy link

vote vote +1

@Hronom
Copy link
Contributor

Hronom commented Sep 8, 2017

obviously +1

@philwebb philwebb added this to the Backlog milestone Mar 22, 2018
@philwebb philwebb removed status: ideal-for-contribution An issue that a contributor can help us with status: waiting-for-votes labels Mar 22, 2018
@snicoll snicoll self-assigned this Aug 22, 2018
@snicoll
Copy link
Member

snicoll commented Aug 23, 2018

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

@gorodum
Copy link

gorodum commented Apr 6, 2020

+1

@philwebb philwebb added the status: blocked An issue that's blocked on an external project change label Apr 16, 2020
@philwebb philwebb marked this as a duplicate of #43985 Jan 28, 2025
@philwebb philwebb self-assigned this Jan 29, 2025
@philwebb philwebb modified the milestones: General Backlog, 3.5.0-M2 Jan 29, 2025
@philwebb philwebb removed the status: blocked An issue that's blocked on an external project change label Jan 29, 2025
@philwebb
Copy link
Member

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

@philwebb philwebb changed the title Make @ConditionalOnProperty @Repeatable Make @ConditionalOnProperty and @ConditionalOnBooleanProperty @Repeatable Jan 29, 2025
# for free to join this conversation on GitHub. Already have an account? # to comment
Labels
type: enhancement A general enhancement
Projects
None yet
Development

No branches or pull requests

9 participants