Example usage for org.springframework.context.annotation ConditionEvaluator ConditionEvaluator

List of usage examples for org.springframework.context.annotation ConditionEvaluator ConditionEvaluator

Introduction

In this page you can find the example usage for org.springframework.context.annotation ConditionEvaluator ConditionEvaluator.

Prototype

public ConditionEvaluator(@Nullable BeanDefinitionRegistry registry, @Nullable Environment environment,
        @Nullable ResourceLoader resourceLoader) 

Source Link

Document

Create a new ConditionEvaluator instance.

Usage

From source file:org.springframework.context.annotation.ClassPathScanningCandidateComponentProvider.java

/**
 * Determine whether the given class is a candidate component based on any
 * {@code @Conditional} annotations./*from   ww  w  .ja  v a 2 s  .  c  o m*/
 * @param metadataReader the ASM ClassReader for the class
 * @return whether the class qualifies as a candidate component
 */
private boolean isConditionMatch(MetadataReader metadataReader) {
    if (this.conditionEvaluator == null) {
        this.conditionEvaluator = new ConditionEvaluator(getRegistry(), this.environment,
                this.resourcePatternResolver);
    }
    return !this.conditionEvaluator.shouldSkip(metadataReader.getAnnotationMetadata());
}

From source file:org.springframework.context.annotation.ConfigurationClassBeanDefinitionReader.java

/**
 * Create a new {@link ConfigurationClassBeanDefinitionReader} instance that will be used
 * to populate the given {@link BeanDefinitionRegistry}.
 *//*from   w w w .  j  a  v a 2s.co m*/
ConfigurationClassBeanDefinitionReader(BeanDefinitionRegistry registry, SourceExtractor sourceExtractor,
        ResourceLoader resourceLoader, Environment environment, BeanNameGenerator importBeanNameGenerator,
        ImportRegistry importRegistry) {

    this.registry = registry;
    this.sourceExtractor = sourceExtractor;
    this.resourceLoader = resourceLoader;
    this.environment = environment;
    this.importBeanNameGenerator = importBeanNameGenerator;
    this.importRegistry = importRegistry;
    this.conditionEvaluator = new ConditionEvaluator(registry, environment, resourceLoader);
}

From source file:org.springframework.context.annotation.ConfigurationClassParser.java

/**
 * Create a new {@link ConfigurationClassParser} instance that will be used
 * to populate the set of configuration classes.
 *///  w w w .j ava 2s.c  o  m
public ConfigurationClassParser(MetadataReaderFactory metadataReaderFactory, ProblemReporter problemReporter,
        Environment environment, ResourceLoader resourceLoader,
        BeanNameGenerator componentScanBeanNameGenerator, BeanDefinitionRegistry registry) {

    this.metadataReaderFactory = metadataReaderFactory;
    this.problemReporter = problemReporter;
    this.environment = environment;
    this.resourceLoader = resourceLoader;
    this.registry = registry;
    this.componentScanParser = new ComponentScanAnnotationParser(environment, resourceLoader,
            componentScanBeanNameGenerator, registry);
    this.conditionEvaluator = new ConditionEvaluator(registry, environment, resourceLoader);
}