Package com.helixframework.conditional
Class OnAllPropertiesCondition
java.lang.Object
com.helixframework.conditional.OnAllPropertiesCondition
- All Implemented Interfaces:
org.springframework.context.annotation.Condition
public final class OnAllPropertiesCondition
extends Object
implements org.springframework.context.annotation.Condition
A custom implementation of the
Condition interface
that determines whether a condition is matched based on the presence and values of multiple
properties defined in the application environment.
This condition operates in conjunction with the ConditionalOnAllProperties annotation.
It extracts the PropertyCondition rules from the annotation and evaluates each rule
against the properties available in the Environment.
For each PropertyCondition, the evaluation follows these rules:
- If a property with the specified name exists:
- The value of the property is compared to the expected value defined in the annotation.
- A match occurs if the actual property value matches the expected value.
- If the property does not exist:
- The `matchIfMissing` attribute determines whether the absence is treated as a match.
If all the property conditions specified by ConditionalOnAllProperties are matched,
the condition is considered satisfied, and this class returns `true`. Otherwise, it returns `false`.
This class is typically used to conditionally register beans or configurations based on the presence
and values of multiple properties in the environment.-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionbooleanmatches(org.springframework.context.annotation.ConditionContext context, org.springframework.core.type.AnnotatedTypeMetadata metadata)
-
Constructor Details
-
OnAllPropertiesCondition
public OnAllPropertiesCondition()
-
-
Method Details
-
matches
public boolean matches(org.springframework.context.annotation.ConditionContext context, org.springframework.core.type.AnnotatedTypeMetadata metadata) - Specified by:
matchesin interfaceorg.springframework.context.annotation.Condition
-