Class ResourceCondition
- java.lang.Object
- org.springframework.boot.autoconfigure.condition.SpringBootCondition
- org.springframework.boot.autoconfigure.condition.ResourceCondition
- All Implemented Interfaces:
org.springframework.context.annotation.Condition
- Direct Known Subclasses:
HazelcastConfigResourceCondition
public abstract class ResourceCondition extends SpringBootCondition
SpringBootConditionused to check if a resource can be found using a configurable property and optional default location(s).- Since:
- 1.3.0
Constructor Summary
Constructors Modifier Constructor Description protectedResourceCondition(String name, String prefix, String propertyName, String... resourceLocations)Create a new condition.
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description ConditionOutcomegetMatchOutcome(org.springframework.context.annotation.ConditionContext context, org.springframework.core.type.AnnotatedTypeMetadata metadata)Determine the outcome of the match along with suitable log output.protected ConditionOutcomegetResourceOutcome(org.springframework.context.annotation.ConditionContext context, org.springframework.core.type.AnnotatedTypeMetadata metadata)Check if one of the default resource locations actually exists.protected ConditionMessage.BuilderstartConditionMessage()Methods inherited from class org.springframework.boot.autoconfigure.condition.SpringBootCondition
anyMatches, logOutcome, matches, matches
Constructor Detail
ResourceCondition
protected ResourceCondition(String name, String prefix, String propertyName, String... resourceLocations)
Create a new condition.- Parameters:
name- the name of the componentprefix- the prefix of the configuration keypropertyName- the name of the configuration keyresourceLocations- default location(s) where the configuration file can be found if the configuration key is not specified
Method Detail
getMatchOutcome
public ConditionOutcome getMatchOutcome(org.springframework.context.annotation.ConditionContext context, org.springframework.core.type.AnnotatedTypeMetadata metadata)
Description copied from class:SpringBootConditionDetermine the outcome of the match along with suitable log output.- Specified by:
getMatchOutcomein classSpringBootCondition- Parameters:
context- the condition contextmetadata- the annotation metadata- Returns:
- the condition outcome
getResourceOutcome
protected ConditionOutcome getResourceOutcome(org.springframework.context.annotation.ConditionContext context, org.springframework.core.type.AnnotatedTypeMetadata metadata)
Check if one of the default resource locations actually exists.- Parameters:
context- the condition contextmetadata- the annotation metadata- Returns:
- the condition outcome
startConditionMessage
protected final ConditionMessage.Builder startConditionMessage()