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

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

Introduction

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

Prototype

@Override
    public String[] getBeanNamesForType(ResolvableType type, boolean includeNonSingletons, boolean allowEagerInit) 

Source Link

Usage

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

@Override
public String[] getBeanNamesForType(Class<?> type, boolean includeNonSingletons, boolean allowEagerInit) {
    String[] beanNames = super.getBeanNamesForType(type, includeNonSingletons, allowEagerInit);
    List<ClassPathXmlApplicationContext> contexts = (List<ClassPathXmlApplicationContext>) this
            .getServletContext().getAttribute("pluginsContextsList");
    Set removedPluginsSubMenuSet = (Set<String>) this.getServletContext()
            .getAttribute("removedPluginsSubMenuSet");
    if (contexts != null) {
        for (ClassPathXmlApplicationContext classPathXmlApplicationContext : contexts) {

            String[] beanNamesTemp = classPathXmlApplicationContext.getBeanNamesForType(type,
                    includeNonSingletons, allowEagerInit);
            beanNames = (String[]) ArrayUtils.addAll(beanNames, beanNamesTemp);
        }//from  w w w .  j a  v  a2 s.co m
    }
    Set hs = new HashSet();
    for (int i = 0; i < beanNames.length; i++) {
        String beanName = beanNames[i];
        if (removedPluginsSubMenuSet != null && removedPluginsSubMenuSet.contains(beanName)) {
            continue;
        }
        hs.add(beanName);
    }
    beanNames = (String[]) hs.toArray(new String[0]);
    Arrays.sort(beanNames);
    return beanNames;

}