If an annotated method supports a single event type, the method may
- * declare a single parameter that reflects the event type to listen to. If
- * an annotated method supports multiple event types, this annotation may
+ * declare a single parameter that reflects the event type to listen to.
+ * If an annotated method supports multiple event types, this annotation may
* refer to one or more supported event types using the {@code classes}
* attribute. See {@link #classes} for further details.
*
@@ -42,20 +42,19 @@ import org.springframework.core.annotation.AliasFor;
* when using Java config or manually via the {@code
Annotated methods may have a non-{@code void} return type. When they - * do, the result of the method invocation is sent as a new event. If the - * return type is either an array or a collection, each element is sent as - * a new event. + *
Annotated methods may have a non-{@code void} return type. When they do, + * the result of the method invocation is sent as a new event. If the return type + * is either an array or a collection, each element is sent as a new event. * - *
It is also possible to define the order in which listeners for a - * certain event are invoked. To do so, add a regular + *
It is also possible to define the order in which listeners for a certain + * event are invoked. To do so, add Spring's common * {@link org.springframework.core.annotation.Order @Order} annotation * alongside this annotation. * - *
While it is possible for an event listener to declare that it throws - * arbitrary exception types, any checked exceptions thrown from an event - * listener will be wrapped in a {@link java.lang.reflect.UndeclaredThrowableException} - * since the caller can only handle runtime exceptions. + *
While it is possible for an event listener to declare that it throws arbitrary + * exception types, any checked exceptions thrown from an event listener will be + * wrapped in an {@link java.lang.reflect.UndeclaredThrowableException} since + * the caller can only handle runtime exceptions. * * @author Stephane Nicoll * @since 4.2 @@ -89,4 +88,4 @@ public @interface EventListener { */ String condition() default ""; -} \ No newline at end of file +} diff --git a/spring-jms/src/main/java/org/springframework/jms/annotation/JmsListener.java b/spring-jms/src/main/java/org/springframework/jms/annotation/JmsListener.java index 29cfaa10f7..bf62c49317 100644 --- a/spring-jms/src/main/java/org/springframework/jms/annotation/JmsListener.java +++ b/spring-jms/src/main/java/org/springframework/jms/annotation/JmsListener.java @@ -26,21 +26,20 @@ import java.lang.annotation.Target; import org.springframework.messaging.handler.annotation.MessageMapping; /** - * Annotation that marks a method to be the target of a JMS message - * listener on the specified {@link #destination}. The {@link #containerFactory} - * identifies the {@link org.springframework.jms.config.JmsListenerContainerFactory - * JmsListenerContainerFactory} to use to build the JMS listener container. If not - * set, a default container factory is assumed to be available with a bean - * name of {@code jmsListenerContainerFactory} unless an explicit default has been - * provided through configuration. + * Annotation that marks a method to be the target of a JMS message listener on the + * specified {@link #destination}. The {@link #containerFactory} identifies the + * {@link org.springframework.jms.config.JmsListenerContainerFactory} to use to build + * the JMS listener container. If not set, a default container factory is + * assumed to be available with a bean name of {@code jmsListenerContainerFactory} + * unless an explicit default has been provided through configuration. * - *
Processing of {@code @JmsListener} annotations is performed by
- * registering a {@link JmsListenerAnnotationBeanPostProcessor}. This can be
- * done manually or, more conveniently, through the {@code
Processing of {@code @JmsListener} annotations is performed by registering a
+ * {@link JmsListenerAnnotationBeanPostProcessor}. This can be done manually or,
+ * more conveniently, through the {@code
Annotated methods are allowed to have flexible signatures similar to what - * {@link MessageMapping} provides: + *
Annotated JMS listener methods are allowed to have flexible signatures similar + * to what {@link MessageMapping} provides: *
Annotated methods may have a non-{@code void} return type. When they do, @@ -75,9 +74,9 @@ import org.springframework.messaging.handler.annotation.MessageMapping; */ @Target({ElementType.METHOD, ElementType.ANNOTATION_TYPE}) @Retention(RetentionPolicy.RUNTIME) -@MessageMapping @Documented @Repeatable(JmsListeners.class) +@MessageMapping public @interface JmsListener { /** @@ -88,7 +87,7 @@ public @interface JmsListener { String id() default ""; /** - * The bean name of the {@link org.springframework.jms.config.JmsListenerContainerFactory JmsListenerContainerFactory} + * The bean name of the {@link org.springframework.jms.config.JmsListenerContainerFactory} * to use to create the message listener container responsible for serving this endpoint. *
If not specified, the default container factory is used, if any. */ @@ -96,8 +95,7 @@ public @interface JmsListener { /** * The destination name for this listener, resolved through the container-wide - * {@link org.springframework.jms.support.destination.DestinationResolver DestinationResolver} - * strategy. + * {@link org.springframework.jms.support.destination.DestinationResolver} strategy. */ String destination(); diff --git a/spring-jms/src/main/java/org/springframework/jms/annotation/JmsListenerAnnotationBeanPostProcessor.java b/spring-jms/src/main/java/org/springframework/jms/annotation/JmsListenerAnnotationBeanPostProcessor.java index 373f8443a4..334a359891 100644 --- a/spring-jms/src/main/java/org/springframework/jms/annotation/JmsListenerAnnotationBeanPostProcessor.java +++ b/spring-jms/src/main/java/org/springframework/jms/annotation/JmsListenerAnnotationBeanPostProcessor.java @@ -54,8 +54,8 @@ import org.springframework.util.StringUtils; /** * Bean post-processor that registers methods annotated with {@link JmsListener} * to be invoked by a JMS message listener container created under the cover - * by a {@link org.springframework.jms.config.JmsListenerContainerFactory} according - * to the parameters of the annotation. + * by a {@link org.springframework.jms.config.JmsListenerContainerFactory} + * according to the attributes of the annotation. * *
Annotated methods can use flexible arguments as defined by {@link JmsListener}.
*
@@ -63,10 +63,10 @@ import org.springframework.util.StringUtils;
* {@code Auto-detect any {@link JmsListenerConfigurer} instances in the container,
+ * Autodetects any {@link JmsListenerConfigurer} instances in the container,
* allowing for customization of the registry to be used, the default container
- * factory or for fine-grained control over endpoints registration. See
- * {@link EnableJms} Javadoc for complete usage details.
+ * factory or for fine-grained control over endpoints registration. See the
+ * {@link EnableJms} javadocs for complete usage details.
*
* @author Stephane Nicoll
* @author Juergen Hoeller
@@ -282,7 +282,7 @@ public class JmsListenerAnnotationBeanPostProcessor
return resolve(jmsListener.id());
}
else {
- return "org.springframework.jms.JmsListenerEndpointContainer#" + counter.getAndIncrement();
+ return "org.springframework.jms.JmsListenerEndpointContainer#" + this.counter.getAndIncrement();
}
}