类 AdviceModeImportSelector<A extends Annotation>
- java.lang.Object
- org.springframework.context.annotation.AdviceModeImportSelector<A>
- 类型参数:
A
- annotation containing AdviceMode attribute
- 所有已实现的接口:
ImportSelector
- 直接已知子类:
AsyncConfigurationSelector
,CachingConfigurationSelector
,TransactionManagementConfigurationSelector
public abstract class AdviceModeImportSelector<A extends Annotation> extends Object implements ImportSelector
Convenient base class forImportSelector
implementations that select imports based on anAdviceMode
value from an annotation (such as the@Enable*
annotations).- 从以下版本开始:
- 3.1
- 作者:
- Chris Beams
字段概要
字段 修饰符和类型 字段 说明 static String
DEFAULT_ADVICE_MODE_ATTRIBUTE_NAME
The default advice mode attribute name.
构造器概要
构造器 构造器 说明 AdviceModeImportSelector()
方法概要
所有方法 实例方法 抽象方法 具体方法 修饰符和类型 方法 说明 protected String
getAdviceModeAttributeName()
The name of theAdviceMode
attribute for the annotation specified by the generic typeA
.protected abstract String[]
selectImports(AdviceMode adviceMode)
Determine which classes should be imported based on the givenAdviceMode
.String[]
selectImports(AnnotationMetadata importingClassMetadata)
This implementation resolves the type of annotation from generic metadata and validates that (a) the annotation is in fact present on the importing@Configuration
class and (b) that the given annotation has an advice mode attribute of typeAdviceMode
.从类继承的方法 java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
从接口继承的方法 org.springframework.context.annotation.ImportSelector
getExclusionFilter
字段详细资料
DEFAULT_ADVICE_MODE_ATTRIBUTE_NAME
public static final String DEFAULT_ADVICE_MODE_ATTRIBUTE_NAME
The default advice mode attribute name.- 另请参阅:
- 常量字段值
构造器详细资料
AdviceModeImportSelector
public AdviceModeImportSelector()
方法详细资料
getAdviceModeAttributeName
protected String getAdviceModeAttributeName()
The name of theAdviceMode
attribute for the annotation specified by the generic typeA
. The default is "mode", but subclasses may override in order to customize.
selectImports
public final String[] selectImports(AnnotationMetadata importingClassMetadata)
This implementation resolves the type of annotation from generic metadata and validates that (a) the annotation is in fact present on the importing@Configuration
class and (b) that the given annotation has an advice mode attribute of typeAdviceMode
.The
selectImports(AdviceMode)
method is then invoked, allowing the concrete implementation to choose imports in a safe and convenient fashion.- 指定者:
selectImports
在接口中ImportSelector
- 返回:
- the class names, or an empty array if none
- 抛出:
IllegalArgumentException
- if expected annotationA
is not present on the importing@Configuration
class or ifselectImports(AdviceMode)
returnsnull
selectImports
@Nullable protected abstract String[] selectImports(AdviceMode adviceMode)
Determine which classes should be imported based on the givenAdviceMode
.Returning
null
from this method indicates that theAdviceMode
could not be handled or was unknown and that anIllegalArgumentException
should be thrown.- 参数:
adviceMode
- the value of the advice mode attribute for the annotation specified via generics.- 返回:
- array containing classes to import (empty array if none;
null
if the givenAdviceMode
is unknown)