Example usage for org.springframework.core DecoratingClassLoader excludeClass

List of usage examples for org.springframework.core DecoratingClassLoader excludeClass

Introduction

In this page you can find the example usage for org.springframework.core DecoratingClassLoader excludeClass.

Prototype

public void excludeClass(String className) 

Source Link

Document

Add a class name to exclude from decoration (e.g.

Usage

From source file:org.apache.struts2.spring.ClassReloadingBeanFactory.java

protected Class resolveBeanClass(RootBeanDefinition mbd, String beanName, Class[] typesToMatch) {
    try {//from w  ww.  j a va 2  s. c  o  m
        //commented to cached class is not used
        /* if (mbd.hasBeanClass()) {
        return mbd.getBeanClass();
        }*/
        if (typesToMatch != null) {
            ClassLoader tempClassLoader = getTempClassLoader();
            if (tempClassLoader != null) {
                if (tempClassLoader instanceof DecoratingClassLoader) {
                    DecoratingClassLoader dcl = (DecoratingClassLoader) tempClassLoader;
                    for (int i = 0; i < typesToMatch.length; i++) {
                        dcl.excludeClass(typesToMatch[i].getName());
                    }
                }
                String className = mbd.getBeanClassName();
                return (className != null ? ClassUtils.forName(className, tempClassLoader) : null);
            }
        }
        return mbd.resolveBeanClass(getBeanClassLoader());
    } catch (ClassNotFoundException ex) {
        throw new CannotLoadBeanClassException(mbd.getResourceDescription(), beanName, mbd.getBeanClassName(),
                ex);
    } catch (LinkageError err) {
        throw new CannotLoadBeanClassException(mbd.getResourceDescription(), beanName, mbd.getBeanClassName(),
                err);
    }
}