批注接口 ConditionalOnBooleanProperty
@Retention(RUNTIME)
@Target({TYPE,METHOD})
@Documented
@Conditional(org.springframework.boot.autoconfigure.condition.OnPropertyCondition.class)
@Repeatable(ConditionalOnBooleanProperties.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.
- 从以下版本开始:
- 3.5.0
- 作者:
- Phillip Webb
- 另请参阅:
-
元素详细资料
-
value
String[] valueAlias forname()
.- 返回:
- the names
- 默认值:
{}
-
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"
).- 返回:
- the prefix
- 默认值:
""
-
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.
- 返回:
- the names
- 默认值:
{}
-
havingValue
boolean havingValueThe expected value for the properties. If not specified, the property must be equal totrue
.- 返回:
- the expected value
- 默认值:
true
-
matchIfMissing
boolean matchIfMissingSpecify if the condition should match if the property is not set. Defaults tofalse
.- 返回:
- if the condition should match if the property is missing
- 默认值:
false
-