Top Description Inners Fields Constructors Methods
org.springframework.context.annotation

pack-priv Class ConditionEvaluator

extends Object
Class Inheritance
Imports
java.util.ArrayList, .Collections, .List, org.springframework.beans.BeanUtils, org.springframework.beans.factory.config.ConfigurableListableBeanFactory, org.springframework.beans.factory.support.BeanDefinitionRegistry, org.springframework.context.ConfigurableApplicationContext, org.springframework.context.annotation.ConfigurationCondition.ConfigurationPhase, org.springframework.core.annotation.AnnotationAwareOrderComparator, org.springframework.core.env.Environment, .EnvironmentCapable, .StandardEnvironment, org.springframework.core.io.DefaultResourceLoader, .ResourceLoader, org.springframework.core.type.AnnotatedTypeMetadata, .AnnotationMetadata, org.springframework.lang.Nullable, org.springframework.util.Assert, .ClassUtils, .MultiValueMap

Internal class used to evaluate Conditional annotations.
Authors
Phillip Webb, Juergen Hoeller
Since
4.0

Nested and Inner Type Summary

Modifier and TypeClass and Description
private static class

Field Summary

Modifier and TypeField and Description
private final ConditionEvaluator.ConditionContextImpl

Constructor Summary

AccessConstructor and Description
public
ConditionEvaluator(BeanDefinitionRegistry registry, Environment environment, ResourceLoader resourceLoader)

Create a new ConditionEvaluator instance.

Method Summary

Modifier and TypeMethod and Description
private Condition
getCondition(String conditionClassName, ClassLoader classloader)

private List<String[]>
public boolean

Returns:

if the item should be skipped
shouldSkip
(AnnotatedTypeMetadata
the meta data
metadata
)

Determine if an item should be skipped based on @Conditional annotations.

public boolean

Returns:

if the item should be skipped
shouldSkip
(AnnotatedTypeMetadata
the meta data
metadata
,
ConfigurationCondition.ConfigurationPhase
the phase of the call
phase
)

Determine if an item should be skipped based on @Conditional annotations.

Inherited from java.lang.Object:
cloneequalsfinalizegetClasshashCodenotifynotifyAlltoStringwaitwaitwait

Field Detail

contextback to summary
private final ConditionEvaluator.ConditionContextImpl context

Constructor Detail

ConditionEvaluatorback to summary
public ConditionEvaluator(BeanDefinitionRegistry registry, Environment environment, ResourceLoader resourceLoader)

Create a new ConditionEvaluator instance.

Method Detail

getConditionback to summary
private Condition getCondition(String conditionClassName, ClassLoader classloader)
getConditionClassesback to summary
private List<String[]> getConditionClasses(AnnotatedTypeMetadata metadata)
Annotations
@SuppressWarnings:unchecked
shouldSkipback to summary
public boolean shouldSkip(AnnotatedTypeMetadata metadata)

Determine if an item should be skipped based on @Conditional annotations. The ConfigurationPhase will be deduced from the type of item (i.e. a @Configuration class will be ConfigurationPhase#PARSE_CONFIGURATION)

Parameters
metadata:AnnotatedTypeMetadata

the meta data

Returns:boolean

if the item should be skipped

shouldSkipback to summary
public boolean shouldSkip(AnnotatedTypeMetadata metadata, ConfigurationCondition.ConfigurationPhase phase)

Determine if an item should be skipped based on @Conditional annotations.

Parameters
metadata:AnnotatedTypeMetadata

the meta data

phase:ConfigurationCondition.ConfigurationPhase

the phase of the call

Returns:boolean

if the item should be skipped

org.springframework.context.annotation back to summary

private Class ConditionEvaluator.ConditionContextImpl

extends Object
implements ConditionContext
Class Inheritance
  • java.lang.Object
  • org.springframework.context.annotation.ConditionEvaluator.ConditionContextImpl
All Implemented Interfaces
org.springframework.context.annotation.ConditionContext

Implementation of a ConditionContext.

Field Summary

Modifier and TypeField and Description
private final ConfigurableListableBeanFactory
private final ClassLoader
private final Environment
private final BeanDefinitionRegistry
private final ResourceLoader

Constructor Summary

AccessConstructor and Description
public

Method Summary

Modifier and TypeMethod and Description
private static ConfigurableListableBeanFactory
private static ClassLoader
private static Environment
private static ResourceLoader
public ConfigurableListableBeanFactory
getBeanFactory()

Implements org.springframework.context.annotation.ConditionContext.getBeanFactory.

Return the ConfigurableListableBeanFactory that will hold the bean definition should the condition match, or null if the bean factory is not available (or not downcastable to ConfigurableListableBeanFactory).
public ClassLoader
getClassLoader()

Implements org.springframework.context.annotation.ConditionContext.getClassLoader.

Return the ClassLoader that should be used to load additional classes (only null if even the system ClassLoader isn't accessible).
public Environment
getEnvironment()

Implements org.springframework.context.annotation.ConditionContext.getEnvironment.

Return the Environment for which the current application is running.
public BeanDefinitionRegistry
getRegistry()

Implements org.springframework.context.annotation.ConditionContext.getRegistry.

Return the BeanDefinitionRegistry that will hold the bean definition should the condition match.
public ResourceLoader
Inherited from java.lang.Object:
cloneequalsfinalizegetClasshashCodenotifynotifyAlltoStringwaitwaitwait

Field Detail

beanFactoryback to summary
private final ConfigurableListableBeanFactory beanFactory
Annotations
@Nullable
classLoaderback to summary
private final ClassLoader classLoader
Annotations
@Nullable
environmentback to summary
private final Environment environment
registryback to summary
private final BeanDefinitionRegistry registry
Annotations
@Nullable
resourceLoaderback to summary
private final ResourceLoader resourceLoader

Constructor Detail

ConditionContextImplback to summary
public ConditionContextImpl(BeanDefinitionRegistry registry, Environment environment, ResourceLoader resourceLoader)

Method Detail

deduceBeanFactoryback to summary
private static ConfigurableListableBeanFactory deduceBeanFactory(BeanDefinitionRegistry source)
Annotations
@Nullable
deduceClassLoaderback to summary
private static ClassLoader deduceClassLoader(ResourceLoader resourceLoader, ConfigurableListableBeanFactory beanFactory)
Annotations
@Nullable
deduceEnvironmentback to summary
private static Environment deduceEnvironment(BeanDefinitionRegistry source)
deduceResourceLoaderback to summary
private static ResourceLoader deduceResourceLoader(BeanDefinitionRegistry source)
getBeanFactoryback to summary
public ConfigurableListableBeanFactory getBeanFactory()

Implements org.springframework.context.annotation.ConditionContext.getBeanFactory.

Doc from org.springframework.context.annotation.ConditionContext.getBeanFactory.

Return the ConfigurableListableBeanFactory that will hold the bean definition should the condition match, or null if the bean factory is not available (or not downcastable to ConfigurableListableBeanFactory).

Annotations
@Override
@Nullable
getClassLoaderback to summary
public ClassLoader getClassLoader()

Implements org.springframework.context.annotation.ConditionContext.getClassLoader.

Doc from org.springframework.context.annotation.ConditionContext.getClassLoader.

Return the ClassLoader that should be used to load additional classes (only null if even the system ClassLoader isn't accessible).

Annotations
@Override
@Nullable
getEnvironmentback to summary
public Environment getEnvironment()

Implements org.springframework.context.annotation.ConditionContext.getEnvironment.

Doc from org.springframework.context.annotation.ConditionContext.getEnvironment.

Return the Environment for which the current application is running.

Annotations
@Override
getRegistryback to summary
public BeanDefinitionRegistry getRegistry()

Implements org.springframework.context.annotation.ConditionContext.getRegistry.

Doc from org.springframework.context.annotation.ConditionContext.getRegistry.

Return the BeanDefinitionRegistry that will hold the bean definition should the condition match.

Annotations
@Override
getResourceLoaderback to summary
public ResourceLoader getResourceLoader()

Implements org.springframework.context.annotation.ConditionContext.getResourceLoader.

Doc from org.springframework.context.annotation.ConditionContext.getResourceLoader.

Return the ResourceLoader currently being used.

Annotations
@Override