question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Make @ConditionalOnProperty @Repeatable

See original GitHub issue

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.

Issue Analytics

  • State:open
  • Created 9 years ago
  • Reactions:30
  • Comments:11 (6 by maintainers)

github_iconTop GitHub Comments

10reactions
derTobschcommented, Apr 11, 2016

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

0reactions
gorodumcommented, Apr 6, 2020

+1

Read more comments on GitHub >

github_iconTop Results From Across the Web

Spring @ConditionalOnProperty havingValue = "value1" or ...
The annotations @ConditionalOnProperty and @ConditionalOnExpression both do NOT have the java.lang.annotation.Repeatable annotation so you ...
Read more >
Bountysource
Make @ConditionalOnProperty @Repeatable.
Read more >
Spring @ConditionalOnProperty havingValue = "value1" or ...
Coding example for the question Spring @ConditionalOnProperty havingValue ... a value of value1 or value2 you would create an AnyNestedCondition like this:
Read more >
The Spring @ConditionalOnProperty Annotation - Baeldung
Now let's see how to make use of the @ConditionalOnProperty annotation. Let's configure the NotificationSender bean in such a way that it'll ...
Read more >
spring-projects/spring-boot - Gitter
Sadly cannot do it in Java 7 ... So 2 @ConditionalOnProperty annotations on the same bean ... You were referring to repeatable annotations...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found