Java Code Examples for org.springframework.messaging.handler.invocation.InvocableHandlerMethod#setMessageMethodArgumentResolvers()

The following examples show how to use org.springframework.messaging.handler.invocation.InvocableHandlerMethod#setMessageMethodArgumentResolvers() . You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: AbstractBinderTests.java    From spring-cloud-stream with Apache License 2.0 6 votes vote down vote up
private StreamListenerMessageHandler buildStreamListener(Class<?> handlerClass,
			String handlerMethodName, Class<?>... parameters) throws Exception {
		String channelName = "reply_" + System.nanoTime();

		this.applicationContext.getBeanFactory().registerSingleton(channelName, new QueueChannel());

		Method m = ReflectionUtils.findMethod(handlerClass, handlerMethodName,
				parameters);
		InvocableHandlerMethod method = new InvocableHandlerMethod(this, m);
		HandlerMethodArgumentResolverComposite resolver = new HandlerMethodArgumentResolverComposite();
		CompositeMessageConverterFactory factory = new CompositeMessageConverterFactory();
		resolver.addResolver(new PayloadArgumentResolver(
				factory.getMessageConverterForAllRegistered()));
		method.setMessageMethodArgumentResolvers(resolver);
		Constructor<?> c = ReflectionUtils.accessibleConstructor(
				StreamListenerMessageHandler.class, InvocableHandlerMethod.class,
				boolean.class, String[].class);
		StreamListenerMessageHandler handler = (StreamListenerMessageHandler) c
				.newInstance(method, false, new String[] {});
		handler.setOutputChannelName(channelName);
		handler.setBeanFactory(this.applicationContext);
		handler.afterPropertiesSet();
//		context.refresh();
		return handler;
	}
 
Example 2
Source File: DefaultMessageHandlerMethodFactory.java    From spring-analysis-note with MIT License 4 votes vote down vote up
@Override
public InvocableHandlerMethod createInvocableHandlerMethod(Object bean, Method method) {
	InvocableHandlerMethod handlerMethod = new InvocableHandlerMethod(bean, method);
	handlerMethod.setMessageMethodArgumentResolvers(this.argumentResolvers);
	return handlerMethod;
}
 
Example 3
Source File: DefaultMessageHandlerMethodFactory.java    From java-technology-stack with MIT License 4 votes vote down vote up
@Override
public InvocableHandlerMethod createInvocableHandlerMethod(Object bean, Method method) {
	InvocableHandlerMethod handlerMethod = new InvocableHandlerMethod(bean, method);
	handlerMethod.setMessageMethodArgumentResolvers(this.argumentResolvers);
	return handlerMethod;
}
 
Example 4
Source File: DefaultMessageHandlerMethodFactory.java    From spring4-understanding with Apache License 2.0 4 votes vote down vote up
@Override
public InvocableHandlerMethod createInvocableHandlerMethod(Object bean, Method method) {
	InvocableHandlerMethod handlerMethod = new InvocableHandlerMethod(bean, method);
	handlerMethod.setMessageMethodArgumentResolvers(argumentResolvers);
	return handlerMethod;
}