Class AllNestedConditions

  • All Implemented Interfaces:
    org.springframework.context.annotation.Condition, org.springframework.context.annotation.ConfigurationCondition

    public abstract class AllNestedConditions
    extends SpringBootCondition
    Condition that will match when all nested class conditions match. Can be used to create composite conditions, for example:
     static class OnJndiAndProperty extends AllNestedConditions {
    
        OnJndiAndProperty() {
            super(ConfigurationPhase.PARSE_CONFIGURATION);
        }
    
        @ConditionalOnJndi()
        static class OnJndi {
        }
    
        @ConditionalOnProperty("something")
        static class OnProperty {
        }
    
     }
     

    The ConfigurationPhase should be specified according to the conditions that are defined. In the example above, all conditions are static and can be evaluated early so PARSE_CONFIGURATION is a right fit.

    Since:
    1.3.0
    • Nested Class Summary

      • Nested classes/interfaces inherited from interface org.springframework.context.annotation.ConfigurationCondition

        org.springframework.context.annotation.ConfigurationCondition.ConfigurationPhase
    • Constructor Summary

      Constructors 
      ConstructorDescription
      AllNestedConditions​(org.springframework.context.annotation.ConfigurationCondition.ConfigurationPhase configurationPhase) 
    • Constructor Detail

      • AllNestedConditions

        public AllNestedConditions​(org.springframework.context.annotation.ConfigurationCondition.ConfigurationPhase configurationPhase)
    • Method Detail

      • getFinalMatchOutcome

        protected ConditionOutcome getFinalMatchOutcome​(org.springframework.boot.autoconfigure.condition.AbstractNestedCondition.MemberMatchOutcomes memberOutcomes)
      • getConfigurationPhase

        public org.springframework.context.annotation.ConfigurationCondition.ConfigurationPhase getConfigurationPhase()
        Specified by:
        getConfigurationPhase in interface org.springframework.context.annotation.ConfigurationCondition
      • getMatchOutcome

        public ConditionOutcome getMatchOutcome​(org.springframework.context.annotation.ConditionContext context,
                                                org.springframework.core.type.AnnotatedTypeMetadata metadata)
        Description copied from class: SpringBootCondition
        Determine the outcome of the match along with suitable log output.
        Specified by:
        getMatchOutcome in class SpringBootCondition
        Parameters:
        context - the condition context
        metadata - the annotation metadata
        Returns:
        the condition outcome