org.springframework.boot.context.annotation

Class Configurations

  • java.lang.Object
    • org.springframework.boot.context.annotation.Configurations
  • Direct Known Subclasses:
    UserConfigurations


    public abstract class Configurations
    extends java.lang.Object
    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.

    Since:
    2.0.0
    See Also:
    UserConfigurations
    • Constructor Summary

      Constructors 
      Modifier Constructor and Description
      protected Configurations(java.util.Collection<java.lang.Class<?>> classes) 
    • Method Summary

      All Methods Static Methods Instance Methods Abstract Methods Concrete Methods 
      Modifier and Type Method and Description
      protected java.util.Set<java.lang.Class<?>> getClasses() 
      static java.lang.Class<?>[] getClasses(java.util.Collection<Configurations> configurations)
      Return the classes from all the specified configurations in the order that they would be registered.
      static java.lang.Class<?>[] getClasses(Configurations... configurations)
      Return the classes from all the specified configurations in the order that they would be registered.
      protected Configurations merge(Configurations other)
      Merge configurations from another source of the same type.
      protected abstract Configurations merge(java.util.Set<java.lang.Class<?>> mergedClasses)
      Merge configurations.
      protected java.util.Collection<java.lang.Class<?>> sort(java.util.Collection<java.lang.Class<?>> classes)
      Sort configuration classes into the order that they should be applied.
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • Constructor Detail

      • Configurations

        protected Configurations(java.util.Collection<java.lang.Class<?>> classes)
    • Method Detail

      • sort

        protected java.util.Collection<java.lang.Class<?>> sort(java.util.Collection<java.lang.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 java.util.Set<java.lang.Class<?>> getClasses()
      • merge

        protected Configurations merge(Configurations other)
        Merge configurations from another source of the same type.
        Parameters:
        other - the other Configurations (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(java.util.Set<java.lang.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 java.lang.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 java.lang.Class<?>[] getClasses(java.util.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