Skip to content

Commit d0033f1

Browse files
committed
ApplicationListenerMethodAdapter uses target method for order lookup
Fixes spring-projects#22307
1 parent 85ec9b9 commit d0033f1

File tree

1 file changed

+5
-5
lines changed

1 file changed

+5
-5
lines changed

spring-context/src/main/java/org/springframework/context/event/ApplicationListenerMethodAdapter.java

+5-5
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* Copyright 2002-2018 the original author or authors.
2+
* Copyright 2002-2019 the original author or authors.
33
*
44
* Licensed under the Apache License, Version 2.0 (the "License");
55
* you may not use this file except in compliance with the License.
@@ -94,11 +94,10 @@ public ApplicationListenerMethodAdapter(String beanName, Class<?> targetClass, M
9494
EventListener ann = AnnotatedElementUtils.findMergedAnnotation(this.targetMethod, EventListener.class);
9595
this.declaredEventTypes = resolveDeclaredEventTypes(method, ann);
9696
this.condition = (ann != null ? ann.condition() : null);
97-
this.order = resolveOrder(method);
97+
this.order = resolveOrder(this.targetMethod);
9898
}
9999

100-
101-
private List<ResolvableType> resolveDeclaredEventTypes(Method method, @Nullable EventListener ann) {
100+
private static List<ResolvableType> resolveDeclaredEventTypes(Method method, @Nullable EventListener ann) {
102101
int count = method.getParameterCount();
103102
if (count > 1) {
104103
throw new IllegalStateException(
@@ -123,11 +122,12 @@ private List<ResolvableType> resolveDeclaredEventTypes(Method method, @Nullable
123122
return Collections.singletonList(ResolvableType.forMethodParameter(method, 0));
124123
}
125124

126-
private int resolveOrder(Method method) {
125+
private static int resolveOrder(Method method) {
127126
Order ann = AnnotatedElementUtils.findMergedAnnotation(method, Order.class);
128127
return (ann != null ? ann.value() : 0);
129128
}
130129

130+
131131
/**
132132
* Initialize this instance.
133133
*/

0 commit comments

Comments
 (0)