Browse Source
Previously, a method could only declare one Jms endpoint so if several destinations share the exact same business logic, you'd still need one separate method declaration per destination. We now make sure that JmsListener is a repeatable annotation, introducing JmsListeners for pre Java8 use cases. Issue: SPR-13147pull/825/head
Stephane Nicoll
10 years ago
10 changed files with 180 additions and 10 deletions
@ -0,0 +1,44 @@
@@ -0,0 +1,44 @@
|
||||
/* |
||||
* Copyright 2002-2015 the original author or authors. |
||||
* |
||||
* Licensed under the Apache License, Version 2.0 (the "License"); |
||||
* you may not use this file except in compliance with the License. |
||||
* You may obtain a copy of the License at |
||||
* |
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
* |
||||
* Unless required by applicable law or agreed to in writing, software |
||||
* distributed under the License is distributed on an "AS IS" BASIS, |
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. |
||||
* See the License for the specific language governing permissions and |
||||
* limitations under the License. |
||||
*/ |
||||
|
||||
package org.springframework.jms.annotation; |
||||
|
||||
import java.lang.annotation.Documented; |
||||
import java.lang.annotation.ElementType; |
||||
import java.lang.annotation.Retention; |
||||
import java.lang.annotation.RetentionPolicy; |
||||
import java.lang.annotation.Target; |
||||
|
||||
/** |
||||
* Container annotation that aggregates several {@link JmsListener} annotations. |
||||
* |
||||
* <p>Can be used natively, declaring several nested {@link JmsListener} annotations. |
||||
* Can also be used in conjunction with Java 8's support for repeatable annotations, |
||||
* where {@link JmsListener} can simply be declared several times on the same method, |
||||
* implicitly generating this container annotation. |
||||
* |
||||
* @author Stephane Nicoll |
||||
* @since 4.2 |
||||
* @see JmsListener |
||||
*/ |
||||
@Target({ElementType.METHOD, ElementType.ANNOTATION_TYPE}) |
||||
@Retention(RetentionPolicy.RUNTIME) |
||||
@Documented |
||||
public @interface JmsListeners { |
||||
|
||||
JmsListener[] value(); |
||||
|
||||
} |
@ -0,0 +1,18 @@
@@ -0,0 +1,18 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?> |
||||
<beans xmlns="http://www.springframework.org/schema/beans" |
||||
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" |
||||
xmlns:jms="http://www.springframework.org/schema/jms" |
||||
xsi:schemaLocation="http://www.springframework.org/schema/beans |
||||
http://www.springframework.org/schema/beans/spring-beans.xsd |
||||
http://www.springframework.org/schema/jms |
||||
http://www.springframework.org/schema/jms/spring-jms-4.1.xsd"> |
||||
|
||||
<jms:annotation-driven/> |
||||
|
||||
<bean class="org.springframework.jms.annotation.AbstractJmsAnnotationDrivenTests$JmsListenerRepeatableBean"/> |
||||
|
||||
<bean id="jmsListenerContainerFactory" |
||||
class="org.springframework.jms.config.JmsListenerContainerTestFactory"/> |
||||
|
||||
|
||||
</beans> |
@ -0,0 +1,18 @@
@@ -0,0 +1,18 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?> |
||||
<beans xmlns="http://www.springframework.org/schema/beans" |
||||
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" |
||||
xmlns:jms="http://www.springframework.org/schema/jms" |
||||
xsi:schemaLocation="http://www.springframework.org/schema/beans |
||||
http://www.springframework.org/schema/beans/spring-beans.xsd |
||||
http://www.springframework.org/schema/jms |
||||
http://www.springframework.org/schema/jms/spring-jms-4.1.xsd"> |
||||
|
||||
<jms:annotation-driven/> |
||||
|
||||
<bean class="org.springframework.jms.annotation.AbstractJmsAnnotationDrivenTests$JmsListenersBean"/> |
||||
|
||||
<bean id="jmsListenerContainerFactory" |
||||
class="org.springframework.jms.config.JmsListenerContainerTestFactory"/> |
||||
|
||||
|
||||
</beans> |
Loading…
Reference in new issue