Example usage for org.springframework.messaging.handler HandlerMethod HandlerMethod

List of usage examples for org.springframework.messaging.handler HandlerMethod HandlerMethod

Introduction

In this page you can find the example usage for org.springframework.messaging.handler HandlerMethod HandlerMethod.

Prototype

public HandlerMethod(String beanName, BeanFactory beanFactory, Method method) 

Source Link

Document

Create an instance from a bean name, a method, and a BeanFactory .

Usage

From source file:org.springframework.messaging.handler.invocation.AbstractMethodMessageHandler.java

/**
 * Create a HandlerMethod instance from an Object handler that is either a handler
 * instance or a String-based bean name.
 */// w  w w . jav a  2  s .  co  m
protected HandlerMethod createHandlerMethod(Object handler, Method method) {
    HandlerMethod handlerMethod;
    if (handler instanceof String) {
        ApplicationContext context = getApplicationContext();
        Assert.state(context != null, "ApplicationContext is required for resolving handler bean names");
        String beanName = (String) handler;
        handlerMethod = new HandlerMethod(beanName, context.getAutowireCapableBeanFactory(), method);
    } else {
        handlerMethod = new HandlerMethod(handler, method);
    }
    return handlerMethod;
}

From source file:org.springframework.messaging.handler.invocation.reactive.AbstractMethodMessageHandler.java

/**
 * Create a HandlerMethod instance from an Object handler that is either a handler
 * instance or a String-based bean name.
 *//*www  . ja v  a  2s .  co m*/
private HandlerMethod createHandlerMethod(Object handler, Method method) {
    HandlerMethod handlerMethod;
    if (handler instanceof String) {
        ApplicationContext context = getApplicationContext();
        Assert.state(context != null, "ApplicationContext is required for resolving handler bean names");
        String beanName = (String) handler;
        handlerMethod = new HandlerMethod(beanName, context.getAutowireCapableBeanFactory(), method);
    } else {
        handlerMethod = new HandlerMethod(handler, method);
    }
    return handlerMethod;
}