Example usage for org.springframework.beans.factory NoSuchBeanDefinitionException getLocalizedMessage

List of usage examples for org.springframework.beans.factory NoSuchBeanDefinitionException getLocalizedMessage

Introduction

In this page you can find the example usage for org.springframework.beans.factory NoSuchBeanDefinitionException getLocalizedMessage.

Prototype

public String getLocalizedMessage() 

Source Link

Document

Creates a localized description of this throwable.

Usage

From source file:cross.ObjectFactory.java

@Override
public <T> T instantiate(final Class<T> c) {
    if (context != null) {
        try {//  w  ww .ja  va  2s  .c o m
            T t = context.getBean(c);
            log.info("Retrieved bean {} from context!", t.getClass().getName());
            return t;
        } catch (NoSuchBeanDefinitionException nsbde) {
            log.debug("Could not create bean {} from context! Reason:\n {}", c.getName(),
                    nsbde.getLocalizedMessage());
        } catch (BeansException be) {
            log.debug("Could not create bean {} from context! Reason:\n {}", c.getName(),
                    be.getLocalizedMessage());
        }
    }
    log.info("Using regular configuration mechanism on instance of type " + c.getName());
    return configureType(instantiateType(c), this.cfg);
}