Replaced the @Handler annotation with @ServiceActivator.
This commit is contained in:
@@ -36,7 +36,6 @@ import org.springframework.integration.aggregator.AggregatingMessageHandler;
|
||||
@Target(ElementType.METHOD)
|
||||
@Retention(RetentionPolicy.RUNTIME)
|
||||
@Documented
|
||||
@Handler
|
||||
public @interface Aggregator {
|
||||
|
||||
/**
|
||||
|
||||
@@ -46,7 +46,6 @@ import java.lang.annotation.Target;
|
||||
@Retention(RetentionPolicy.RUNTIME)
|
||||
@Inherited
|
||||
@Documented
|
||||
@Handler
|
||||
public @interface Router {
|
||||
|
||||
String inputChannel() default "";
|
||||
|
||||
@@ -26,7 +26,7 @@ import java.lang.annotation.Target;
|
||||
/**
|
||||
* Indicates that a method is capable of handling a message or message payload.
|
||||
* <p>
|
||||
* A method annotated with @Handler may accept a parameter of type
|
||||
* A method annotated with @ServiceActivator may accept a parameter of type
|
||||
* {@link org.springframework.integration.message.Message} or of the expected
|
||||
* Message payload's type. Any type conversion supported by
|
||||
* {@link org.springframework.beans.SimpleTypeConverter} will be applied to
|
||||
@@ -39,11 +39,11 @@ import java.lang.annotation.Target;
|
||||
*
|
||||
* @author Mark Fisher
|
||||
*/
|
||||
@Target({ElementType.METHOD, ElementType.ANNOTATION_TYPE})
|
||||
@Target(ElementType.METHOD)
|
||||
@Retention(RetentionPolicy.RUNTIME)
|
||||
@Inherited
|
||||
@Documented
|
||||
public @interface Handler {
|
||||
public @interface ServiceActivator {
|
||||
|
||||
String inputChannel() default "";
|
||||
|
||||
@@ -42,7 +42,6 @@ import java.lang.annotation.Target;
|
||||
@Target(ElementType.METHOD)
|
||||
@Retention(RetentionPolicy.RUNTIME)
|
||||
@Documented
|
||||
@Handler
|
||||
public @interface Splitter {
|
||||
|
||||
String inputChannel() default "";
|
||||
|
||||
@@ -33,7 +33,6 @@ import java.lang.annotation.Target;
|
||||
@Retention(RetentionPolicy.RUNTIME)
|
||||
@Inherited
|
||||
@Documented
|
||||
@Handler
|
||||
public @interface Transformer {
|
||||
|
||||
String inputChannel() default "";
|
||||
|
||||
@@ -36,8 +36,8 @@ import org.springframework.core.annotation.AnnotationUtils;
|
||||
import org.springframework.integration.ConfigurationException;
|
||||
import org.springframework.integration.annotation.Aggregator;
|
||||
import org.springframework.integration.annotation.ChannelAdapter;
|
||||
import org.springframework.integration.annotation.Handler;
|
||||
import org.springframework.integration.annotation.Router;
|
||||
import org.springframework.integration.annotation.ServiceActivator;
|
||||
import org.springframework.integration.annotation.Splitter;
|
||||
import org.springframework.integration.annotation.Transformer;
|
||||
import org.springframework.integration.bus.MessageBus;
|
||||
@@ -78,8 +78,8 @@ public class MessagingAnnotationPostProcessor implements BeanPostProcessor, Init
|
||||
public void afterPropertiesSet() {
|
||||
postProcessors.put(Aggregator.class, new AggregatorAnnotationPostProcessor(this.messageBus));
|
||||
postProcessors.put(ChannelAdapter.class, new ChannelAdapterAnnotationPostProcessor(this.messageBus));
|
||||
postProcessors.put(Handler.class, new ServiceActivatorAnnotationPostProcessor(this.messageBus));
|
||||
postProcessors.put(Router.class, new RouterAnnotationPostProcessor(this.messageBus));
|
||||
postProcessors.put(ServiceActivator.class, new ServiceActivatorAnnotationPostProcessor(this.messageBus));
|
||||
postProcessors.put(Splitter.class, new SplitterAnnotationPostProcessor(this.messageBus));
|
||||
postProcessors.put(Transformer.class, new TransformerAnnotationPostProcessor(this.messageBus));
|
||||
}
|
||||
|
||||
@@ -18,7 +18,7 @@ package org.springframework.integration.config.annotation;
|
||||
|
||||
import java.lang.reflect.Method;
|
||||
|
||||
import org.springframework.integration.annotation.Handler;
|
||||
import org.springframework.integration.annotation.ServiceActivator;
|
||||
import org.springframework.integration.bus.MessageBus;
|
||||
import org.springframework.integration.endpoint.AbstractEndpoint;
|
||||
import org.springframework.integration.endpoint.DefaultServiceInvoker;
|
||||
@@ -26,9 +26,11 @@ import org.springframework.integration.endpoint.ServiceActivatorEndpoint;
|
||||
import org.springframework.integration.endpoint.ServiceInvoker;
|
||||
|
||||
/**
|
||||
* Post-processor for Methods annotated with {@link ServiceActivator @ServiceActivator}.
|
||||
*
|
||||
* @author Mark Fisher
|
||||
*/
|
||||
public class ServiceActivatorAnnotationPostProcessor extends AbstractMethodAnnotationPostProcessor<Handler> {
|
||||
public class ServiceActivatorAnnotationPostProcessor extends AbstractMethodAnnotationPostProcessor<ServiceActivator> {
|
||||
|
||||
public ServiceActivatorAnnotationPostProcessor(MessageBus messageBus) {
|
||||
super(messageBus);
|
||||
@@ -36,7 +38,7 @@ public class ServiceActivatorAnnotationPostProcessor extends AbstractMethodAnnot
|
||||
|
||||
|
||||
@Override
|
||||
protected Object createMethodInvokingAdapter(Object bean, Method method, Handler annotation) {
|
||||
protected Object createMethodInvokingAdapter(Object bean, Method method, ServiceActivator annotation) {
|
||||
return new DefaultServiceInvoker(bean, method);
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user