Class Configurations
- java.lang.Object
- org.springframework.boot.context.annotation.Configurations
- Direct Known Subclasses:
UserConfigurations
public abstract class Configurations extends Object
A set of@Configuration
classes that can be registered inApplicationContext
. Classes can be returned from one or moreConfigurations
instances by usinggetClasses(Configurations[])
. The resulting array follows the ordering rules usually applied by theApplicationContext
and/or customImportSelector
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 implementOrdered
.- Since:
- 2.0.0
- See Also:
UserConfigurations
Constructor Summary
Constructors Modifier Constructor Description protected
Configurations(Collection<Class<?>> classes)
Method Summary
All Methods Static Methods Instance Methods Abstract Methods Concrete Methods Modifier and Type Method Description protected Set<Class<?>>
getClasses()
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(Set<Class<?>> mergedClasses)
Merge configurations.protected Configurations
merge(Configurations other)
Merge configurations from another source of the same type.protected Collection<Class<?>>
sort(Collection<Class<?>> classes)
Sort configuration classes into the order that they should be applied.
Constructor Detail
Configurations
protected Configurations(Collection<Class<?>> classes)
Method Detail
sort
protected Collection<Class<?>> sort(Collection<Class<?>> classes)
Sort configuration classes into the order that they should be applied.- Parameters:
classes
- the classes to sort- Returns:
- a sorted set of classes
getClasses
protected final Set<Class<?>> getClasses()
merge
protected Configurations merge(Configurations other)
Merge configurations from another source of the same type.- Parameters:
other
- the otherConfigurations
(must be of the same type as this instance)- Returns:
- a new configurations instance (must be of the same type as this instance)
merge
protected abstract Configurations merge(Set<Class<?>> mergedClasses)
Merge configurations.- Parameters:
mergedClasses
- the merged classes- Returns:
- a new configurations instance (must be of the same type as this instance)
getClasses
public static Class<?>[] getClasses(Configurations... configurations)
Return the classes from all the specified configurations in the order that they would be registered.- Parameters:
configurations
- the source configuration- Returns:
- configuration classes in registration order
getClasses
public static Class<?>[] getClasses(Collection<Configurations> configurations)
Return the classes from all the specified configurations in the order that they would be registered.- Parameters:
configurations
- the source configuration- Returns:
- configuration classes in registration order