Order ApplicationListener using @Order

AnnotationListener implementations can now be ordered either using the
`@Order` annotation or by implementing the Ordered interface.

Issue: SPR-12410
This commit is contained in:
Stephane Nicoll
2015-02-16 10:41:26 +01:00
parent 67934a22e2
commit 8eb7beebc8
2 changed files with 44 additions and 3 deletions

View File

@@ -30,8 +30,8 @@ import org.springframework.beans.factory.NoSuchBeanDefinitionException;
import org.springframework.beans.factory.config.ConfigurableBeanFactory;
import org.springframework.context.ApplicationEvent;
import org.springframework.context.ApplicationListener;
import org.springframework.core.OrderComparator;
import org.springframework.core.ResolvableType;
import org.springframework.core.annotation.AnnotationAwareOrderComparator;
import org.springframework.util.ClassUtils;
import org.springframework.util.ObjectUtils;
@@ -234,7 +234,7 @@ public abstract class AbstractApplicationEventMulticaster
}
}
}
OrderComparator.sort(allListeners);
AnnotationAwareOrderComparator.sort(allListeners);
return allListeners;
}
@@ -349,7 +349,7 @@ public abstract class AbstractApplicationEventMulticaster
}
}
}
OrderComparator.sort(allListeners);
AnnotationAwareOrderComparator.sort(allListeners);
return allListeners;
}
}