Skip to content

Commit 5510c6f

Browse files
committed
Clarify that all named properties must match for @ConditionalOnProperty to match
Closes gh-40110
1 parent 1476d8d commit 5510c6f

File tree

2 files changed

+6
-1
lines changed

2 files changed

+6
-1
lines changed

Diff for: spring-boot-project/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/condition/ConditionalOnProperty.java

+4-1
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* Copyright 2012-2021 the original author or authors.
2+
* Copyright 2012-2024 the original author or authors.
33
*
44
* Licensed under the Apache License, Version 2.0 (the "License");
55
* you may not use this file except in compliance with the License.
@@ -117,6 +117,9 @@
117117
* <p>
118118
* Use the dashed notation to specify each property, that is all lower case with a "-"
119119
* to separate words (e.g. {@code my-long-property}).
120+
* <p>
121+
* If multiple names are specified, all of the properties have to pass the test for
122+
* the condition to match.
120123
* @return the names
121124
*/
122125
String[] name() default {};

Diff for: spring-boot-project/spring-boot-docs/src/docs/asciidoc/features/developing-auto-configuration.adoc

+2
Original file line numberDiff line numberDiff line change
@@ -114,6 +114,8 @@ Use the `prefix` and `name` attributes to specify the property that should be ch
114114
By default, any property that exists and is not equal to `false` is matched.
115115
You can also create more advanced checks by using the `havingValue` and `matchIfMissing` attributes.
116116

117+
If multiple names are given in the `name` attribute, all of the properties have to pass the test for the condition to match.
118+
117119

118120

119121
[[features.developing-auto-configuration.condition-annotations.resource-conditions]]

0 commit comments

Comments
 (0)