Skip to content

Commit

Permalink
ApplicationListenerMethodAdapter uses target method for order lookup
Browse files Browse the repository at this point in the history
Fixes #22307
  • Loading branch information
jhoeller committed Jan 25, 2019
1 parent 85ec9b9 commit d0033f1
Showing 1 changed file with 5 additions and 5 deletions.
@@ -1,5 +1,5 @@
/*
* Copyright 2002-2018 the original author or authors.
* Copyright 2002-2019 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.
Expand Down Expand Up @@ -94,11 +94,10 @@ public ApplicationListenerMethodAdapter(String beanName, Class<?> targetClass, M
EventListener ann = AnnotatedElementUtils.findMergedAnnotation(this.targetMethod, EventListener.class);
this.declaredEventTypes = resolveDeclaredEventTypes(method, ann);
this.condition = (ann != null ? ann.condition() : null);
this.order = resolveOrder(method);
this.order = resolveOrder(this.targetMethod);
}


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

private int resolveOrder(Method method) {
private static int resolveOrder(Method method) {
Order ann = AnnotatedElementUtils.findMergedAnnotation(method, Order.class);
return (ann != null ? ann.value() : 0);
}


/**
* Initialize this instance.
*/
Expand Down

0 comments on commit d0033f1

Please sign in to comment.