Search in sources :

Example 1 with BeanInstantiationException

use of org.springframework.beans.BeanInstantiationException in project spring-boot by spring-projects.

the class AbstractInjectionFailureAnalyzer method getDescription.

private String getDescription(Throwable rootFailure) {
    UnsatisfiedDependencyException unsatisfiedDependency = findMostNestedCause(rootFailure, UnsatisfiedDependencyException.class);
    if (unsatisfiedDependency != null) {
        return getDescription(unsatisfiedDependency);
    }
    BeanInstantiationException beanInstantiationException = findMostNestedCause(rootFailure, BeanInstantiationException.class);
    if (beanInstantiationException != null) {
        return getDescription(beanInstantiationException);
    }
    return null;
}
Also used : UnsatisfiedDependencyException(org.springframework.beans.factory.UnsatisfiedDependencyException) BeanInstantiationException(org.springframework.beans.BeanInstantiationException)

Example 2 with BeanInstantiationException

use of org.springframework.beans.BeanInstantiationException in project qi4j-sdk by Qi4j.

the class Qi4jBootstrapBeanDefinitionParser method createQi4jApplicationBootstrap.

private Qi4jApplicationBootstrap createQi4jApplicationBootstrap(Element anElement, ParserContext aParserContext) {
    String bootstrapClassString = anElement.getAttribute(CLASS);
    hasText(bootstrapClassString);
    XmlReaderContext readerContext = aParserContext.getReaderContext();
    Class<?> bootstrapClass;
    try {
        bootstrapClass = forName(bootstrapClassString);
    } catch (ClassNotFoundException e) {
        readerContext.error("Qi4j bootstrap class [" + bootstrapClassString + "] is not found.", anElement);
        return null;
    }
    if (!Qi4jApplicationBootstrap.class.isAssignableFrom(bootstrapClass)) {
        readerContext.error(CLASS + "attribute is not an instance of [" + Qi4jApplicationBootstrap.class.getName() + "] class", anElement);
        return null;
    }
    Qi4jApplicationBootstrap bootstrap = null;
    try {
        bootstrap = (Qi4jApplicationBootstrap) instantiateClass(bootstrapClass);
    } catch (BeanInstantiationException e) {
        readerContext.error("Fail to instantiate qi4j bootstrap class [" + bootstrapClassString + "]", anElement, e);
    }
    return bootstrap;
}
Also used : XmlReaderContext(org.springframework.beans.factory.xml.XmlReaderContext) BeanInstantiationException(org.springframework.beans.BeanInstantiationException) Qi4jApplicationBootstrap(org.qi4j.library.spring.bootstrap.Qi4jApplicationBootstrap)

Aggregations

BeanInstantiationException (org.springframework.beans.BeanInstantiationException)2 Qi4jApplicationBootstrap (org.qi4j.library.spring.bootstrap.Qi4jApplicationBootstrap)1 UnsatisfiedDependencyException (org.springframework.beans.factory.UnsatisfiedDependencyException)1 XmlReaderContext (org.springframework.beans.factory.xml.XmlReaderContext)1