Example usage for org.springframework.beans BeansException BeansException

List of usage examples for org.springframework.beans BeansException BeansException

Introduction

In this page you can find the example usage for org.springframework.beans BeansException BeansException.

Prototype

public BeansException(@Nullable String msg, @Nullable Throwable cause) 

Source Link

Document

Create a new BeansException with the specified message and root cause.

Usage

From source file:com.alfresco.orm.repository.RepositoryBeanPostProcessor.java

public Object postProcessAfterInitialization(Object bean, String beanName) throws BeansException {
    Class clazz = bean.getClass();
    List<Method> repositoryMethod = ReflectionUtil.setterMethodForAnnotation(clazz,
            AlfrescoRepositoryBean.class);
    for (Method method : repositoryMethod) {
        try {//from w w w.ja va 2 s. c  o m
            method.invoke(bean, AlfrescoRespositoryProxyFactoryBean.getAlfrescoRespositoryProxyFactoryBean()
                    .getObject(method.getParameterTypes()[0]));
        } catch (IllegalArgumentException e) {
            throw new BeansException(e.getMessage(), e) {
            };
        } catch (IllegalAccessException e) {
            throw new BeansException(e.getMessage(), e) {
            };
        } catch (InvocationTargetException e) {
            throw new BeansException(e.getMessage(), e) {
            };
        } catch (InstantiationException e) {
            throw new BeansException(e.getMessage(), e) {
            };
        }
    }

    return bean;
}