类 Configurations
java.lang.Object
org.springframework.boot.context.annotation.Configurations
- 直接已知子类:
AutoConfigurations
,UserConfigurations
A set of
@Configuration
classes that can be registered in
ApplicationContext
. Classes can be returned from one or more
Configurations
instances by using getClasses(Configurations[])
. The
resulting array follows the ordering rules usually applied by the
ApplicationContext
and/or custom ImportSelector
implementations.
This class is primarily intended for use with tests that need to specify configuration
classes but can't use SpringRunner
.
Implementations of this class should be annotated with @Order
or
implement Ordered
.
- 从以下版本开始:
- 2.0.0
- 作者:
- Phillip Webb
- 另请参阅:
-
构造器概要
构造器限定符构造器说明protected
Configurations
(Collection<Class<?>> classes) Create a newConfigurations
instance.protected
Configurations
(UnaryOperator<Collection<Class<?>>> sorter, Collection<Class<?>> classes, Function<Class<?>, String> beanNameGenerator) Create a newConfigurations
instance. -
方法概要
修饰符和类型方法说明static List
<Configurations> collate
(Collection<Configurations> configurations) Collate the given configuration by sorting and merging them.getBeanName
(Class<?> beanClass) Return the bean name that should be used for the given configuration class ornull
to use the default name.static Class<?>[]
getClasses
(Collection<Configurations> configurations) Return the classes from all the specified configurations in the order that they would be registered.static Class<?>[]
getClasses
(Configurations... configurations) Return the classes from all the specified configurations in the order that they would be registered.protected abstract Configurations
Merge configurations.protected Configurations
merge
(Configurations other) Merge configurations from another source of the same type.protected Collection
<Class<?>> sort
(Collection<Class<?>> classes) 已过时, 待删除: 此 API 元素将从以后的版本中删除。
-
构造器详细资料
-
Configurations
Create a newConfigurations
instance.- 参数:
classes
- the configuration classes
-
Configurations
protected Configurations(UnaryOperator<Collection<Class<?>>> sorter, Collection<Class<?>> classes, Function<Class<?>, String> beanNameGenerator) Create a newConfigurations
instance.- 参数:
sorter
- aUnaryOperator
used to sort the configurationsclasses
- the configuration classesbeanNameGenerator
- an optional function used to generate the bean name- 从以下版本开始:
- 3.4.0
-
-
方法详细资料
-
getClasses
-
sort
@Deprecated(since="3.4.0", forRemoval=true) protected Collection<Class<?>> sort(Collection<Class<?>> classes) 已过时, 待删除: 此 API 元素将从以后的版本中删除。since 3.4.0 for removal in 4.0.0 in favor ofConfigurations(UnaryOperator, Collection, Function)
Sort configuration classes into the order that they should be applied.- 参数:
classes
- the classes to sort- 返回:
- a sorted set of classes
-
merge
Merge configurations from another source of the same type.- 参数:
other
- the otherConfigurations
(must be of the same type as this instance)- 返回:
- a new configurations instance (must be of the same type as this instance)
-
merge
Merge configurations.- 参数:
mergedClasses
- the merged classes- 返回:
- a new configurations instance (must be of the same type as this instance)
-
getBeanName
Return the bean name that should be used for the given configuration class ornull
to use the default name.- 参数:
beanClass
- the bean class- 返回:
- the bean name
- 从以下版本开始:
- 3.4.0
-
getClasses
Return the classes from all the specified configurations in the order that they would be registered.- 参数:
configurations
- the source configuration- 返回:
- configuration classes in registration order
-
getClasses
Return the classes from all the specified configurations in the order that they would be registered.- 参数:
configurations
- the source configuration- 返回:
- configuration classes in registration order
-
collate
Collate the given configuration by sorting and merging them.- 参数:
configurations
- the source configuration- 返回:
- the collated configurations
- 从以下版本开始:
- 3.4.0
-
Configurations(UnaryOperator, Collection, Function)