Example usage for org.springframework.messaging.core DestinationResolutionException getCause

List of usage examples for org.springframework.messaging.core DestinationResolutionException getCause

Introduction

In this page you can find the example usage for org.springframework.messaging.core DestinationResolutionException getCause.

Prototype

public synchronized Throwable getCause() 

Source Link

Document

Returns the cause of this throwable or null if the cause is nonexistent or unknown.

Usage

From source file:org.springframework.integration.config.annotation.AbstractMethodAnnotationPostProcessor.java

protected AbstractEndpoint createEndpoint(MessageHandler handler, Method method, List<Annotation> annotations) {
    AbstractEndpoint endpoint = null;/*from   w w w .j  av a2 s  .com*/
    String inputChannelName = MessagingAnnotationUtils.resolveAttribute(annotations, getInputChannelAttribute(),
            String.class);
    if (StringUtils.hasText(inputChannelName)) {
        MessageChannel inputChannel;
        try {
            inputChannel = this.channelResolver.resolveDestination(inputChannelName);
        } catch (DestinationResolutionException e) {
            if (e.getCause() instanceof NoSuchBeanDefinitionException) {
                inputChannel = new DirectChannel();
                this.beanFactory.registerSingleton(inputChannelName, inputChannel);
                inputChannel = (MessageChannel) this.beanFactory.initializeBean(inputChannel, inputChannelName);
            } else {
                throw e;
            }
        }
        Assert.notNull(inputChannel, "failed to resolve inputChannel '" + inputChannelName + "'");

        endpoint = doCreateEndpoint(handler, inputChannel, annotations);
    }
    return endpoint;
}