Annotation Interface ConditionalOnBooleanProperty
@Retention(RUNTIME)
@Target({TYPE,METHOD})
@Documented
@Conditional(org.springframework.boot.autoconfigure.condition.OnPropertyCondition.class)
public @interface ConditionalOnBooleanProperty
@Conditional
that checks if the specified properties have a
specific boolean value. By default the properties must be present in the
Environment
and equal to true
. The havingValue()
and
matchIfMissing()
attributes allow further customizations.
If the property is not contained in the Environment
at all, the
matchIfMissing()
attribute is consulted. By default missing attributes do not
match.
- Since:
- 3.5.0
- Author:
- Phillip Webb
- See Also:
-
Optional Element Summary
-
Element Details
-
value
String[] valueAlias forname()
.- Returns:
- the names
- Default:
- {}
-
prefix
String prefixA prefix that should be applied to each property. The prefix automatically ends with a dot if not specified. A valid prefix is defined by one or more words separated with dots (e.g."acme.system.feature"
).- Returns:
- the prefix
- Default:
- ""
-
name
String[] nameThe name of the properties to test. If a prefix has been defined, it is applied to compute the full key of each property. For instance if the prefix isapp.config
and one value ismy-value
, the full key would beapp.config.my-value
Use the dashed notation to specify each property, that is all lower case with a "-" to separate words (e.g.
my-long-property
).If multiple names are specified, all of the properties have to pass the test for the condition to match.
- Returns:
- the names
- Default:
- {}
-
havingValue
boolean havingValueThe expected value for the properties. If not specified, the property must be equal totrue
.- Returns:
- the expected value
- Default:
- true
-
matchIfMissing
boolean matchIfMissingSpecify if the condition should match if the property is not set. Defaults tofalse
.- Returns:
- if the condition should match if the property is missing
- Default:
- false
-