Class ContainerLibrary


  • public class ContainerLibrary
    extends Object
    Convenient methods for instantiating a ConfigurableApplicationContext Spring application container. For more details on the Spring application container, check out: http://www.springsource.org/
    Author:
    bdferris
    • Constructor Detail

      • ContainerLibrary

        public ContainerLibrary()
    • Method Detail

      • createContext

        public static org.springframework.context.ConfigurableApplicationContext createContext​(String... paths)
        Parameters:
        paths - resource paths
        Returns:
        a Spring application container context created from the specified resources
      • createContext

        public static org.springframework.context.ConfigurableApplicationContext createContext​(Iterable<String> paths)
        Parameters:
        paths - resource paths
        Returns:
        a Spring application container context created from the specified resources
      • createContext

        public static org.springframework.context.ConfigurableApplicationContext createContext​(Iterable<String> paths,
                                                                                               Map<String,​org.springframework.beans.factory.config.BeanDefinition> additionalBeans)
        Construct and instantiate a Spring application container from the specified resources. By default, paths are treated as references to classpath resources, but you can prefix with "file:" to specify a file-path resource or "classpath:" to specifically specify a classpath resource. A shutdown hook is automatically registered for the application context.
        Parameters:
        paths - resource paths
        additionalBeans - additional bean defintions to include in the context
        Returns:
        a Spring application container context
      • getBeanOfType

        public static <T> T getBeanOfType​(org.springframework.context.ApplicationContext context,
                                          Class<T> beanType)