Example usage for org.springframework.context.support ClassPathXmlApplicationContext getBeansOfType

List of usage examples for org.springframework.context.support ClassPathXmlApplicationContext getBeansOfType

Introduction

In this page you can find the example usage for org.springframework.context.support ClassPathXmlApplicationContext getBeansOfType.

Prototype

@Override
    public <T> Map<String, T> getBeansOfType(@Nullable Class<T> type, boolean includeNonSingletons,
            boolean allowEagerInit) throws BeansException 

Source Link

Usage

From source file:org.entando.entando.aps.system.XmlWebApplicationContext.java

@Override
public <T> Map<String, T> getBeansOfType(Class<T> type, boolean includeNonSingletons, boolean allowEagerInit)
        throws BeansException {
    Map<String, T> map = super.getBeansOfType(type, includeNonSingletons, allowEagerInit);
    List<ClassPathXmlApplicationContext> contexts = (List<ClassPathXmlApplicationContext>) this
            .getServletContext().getAttribute("pluginsContextsList");
    if (contexts != null) {
        for (ClassPathXmlApplicationContext classPathXmlApplicationContext : contexts) {
            try {
                Map<String, T> tempmap = classPathXmlApplicationContext.getBeansOfType(type,
                        includeNonSingletons, allowEagerInit);
                map.putAll(tempmap);/*from   w w w. j av  a2  s  .c o  m*/
            } catch (Exception ex) {
            }
        }
    }
    return map;
}