Skip to content

AnnotationUtils.findAnnotation(Method method) broken for repeatable anns #22702

@garyrussell

Description

@garyrussell

On 5.2.0.BUILD-SNAPSHOT.

Previously...

	private Collection<RabbitListener> findListenerAnnotations(Method method) {
		Set<RabbitListener> listeners = new HashSet<RabbitListener>();
		RabbitListener ann = AnnotationUtils.findAnnotation(method, RabbitListener.class);
		if (ann != null) {
			listeners.add(ann);
		}
		RabbitListeners anns = AnnotationUtils.findAnnotation(method, RabbitListeners.class);
		if (anns != null) {
			Collections.addAll(listeners, anns.value());
		}
		return listeners;
	}

and

	@Component
	static class RabbitListenersBean {

		@RabbitListeners({
				@RabbitListener(id = "first", queues = "myQueue"),
				@RabbitListener(id = "second", queues = "anotherQueue")
		})
		public void repeatableHandle(String msg) {
		}

	}

Returned null for the first call and and found the container for the second call.

With the current snapshot, the first call now returns just the first "child" annotation.

Metadata

Metadata

Assignees

Labels

in: coreIssues in core modules (aop, beans, core, context, expression)type: regressionA bug that is also a regression

Type

No type

Projects

No projects

Milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions