Used as "catch-all" implementation by default.
*
* @author Stephane Nicoll
@@ -33,15 +34,17 @@ public class DefaultEventListenerFactory implements EventListenerFactory, Ordere
private int order = LOWEST_PRECEDENCE;
- @Override
- public int getOrder() {
- return order;
- }
public void setOrder(int order) {
this.order = order;
}
+ @Override
+ public int getOrder() {
+ return this.order;
+ }
+
+
public boolean supportsMethod(Method method) {
return true;
}
diff --git a/spring-context/src/main/java/org/springframework/context/event/EventListenerMethodProcessor.java b/spring-context/src/main/java/org/springframework/context/event/EventListenerMethodProcessor.java
index 24b8cf97b01..c3a19fe4661 100644
--- a/spring-context/src/main/java/org/springframework/context/event/EventListenerMethodProcessor.java
+++ b/spring-context/src/main/java/org/springframework/context/event/EventListenerMethodProcessor.java
@@ -1,5 +1,5 @@
/*
- * Copyright 2002-2017 the original author or authors.
+ * Copyright 2002-2018 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.
@@ -44,8 +44,7 @@ import org.springframework.util.Assert;
import org.springframework.util.CollectionUtils;
/**
- * Register {@link EventListener} annotated method as individual {@link ApplicationListener}
- * instances.
+ * Registers {@link EventListener} methods as individual {@link ApplicationListener} instances.
*
* @author Stephane Nicoll
* @author Juergen Hoeller
diff --git a/spring-tx/src/main/java/org/springframework/transaction/event/TransactionalEventListenerFactory.java b/spring-tx/src/main/java/org/springframework/transaction/event/TransactionalEventListenerFactory.java
index 19d5ab82f86..57aae2b1340 100644
--- a/spring-tx/src/main/java/org/springframework/transaction/event/TransactionalEventListenerFactory.java
+++ b/spring-tx/src/main/java/org/springframework/transaction/event/TransactionalEventListenerFactory.java
@@ -1,5 +1,5 @@
/*
- * Copyright 2002-2015 the original author or authors.
+ * Copyright 2002-2018 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.
@@ -21,11 +21,11 @@ import java.lang.reflect.Method;
import org.springframework.context.ApplicationListener;
import org.springframework.context.event.EventListenerFactory;
import org.springframework.core.Ordered;
-import org.springframework.core.annotation.AnnotationUtils;
+import org.springframework.core.annotation.AnnotatedElementUtils;
/**
* {@link EventListenerFactory} implementation that handles {@link TransactionalEventListener}
- * annotated method.
+ * annotated methods.
*
* @author Stephane Nicoll
* @since 4.2
@@ -47,7 +47,7 @@ public class TransactionalEventListenerFactory implements EventListenerFactory,
@Override
public boolean supportsMethod(Method method) {
- return (AnnotationUtils.findAnnotation(method, TransactionalEventListener.class) != null);
+ return AnnotatedElementUtils.hasAnnotation(method, TransactionalEventListener.class);
}
@Override
diff --git a/spring-webmvc/src/main/java/org/springframework/web/servlet/mvc/method/annotation/RequestMappingHandlerAdapter.java b/spring-webmvc/src/main/java/org/springframework/web/servlet/mvc/method/annotation/RequestMappingHandlerAdapter.java
index ac2fbf714b4..28717f2eb54 100644
--- a/spring-webmvc/src/main/java/org/springframework/web/servlet/mvc/method/annotation/RequestMappingHandlerAdapter.java
+++ b/spring-webmvc/src/main/java/org/springframework/web/servlet/mvc/method/annotation/RequestMappingHandlerAdapter.java
@@ -1,5 +1,5 @@
/*
- * Copyright 2002-2017 the original author or authors.
+ * Copyright 2002-2018 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.
@@ -116,6 +116,28 @@ import org.springframework.web.util.WebUtils;
public class RequestMappingHandlerAdapter extends AbstractHandlerMethodAdapter
implements BeanFactoryAware, InitializingBean {
+ /**
+ * MethodFilter that matches {@link InitBinder @InitBinder} methods.
+ */
+ public static final MethodFilter INIT_BINDER_METHODS = new MethodFilter() {
+ @Override
+ public boolean matches(Method method) {
+ return (AnnotationUtils.findAnnotation(method, InitBinder.class) != null);
+ }
+ };
+
+ /**
+ * MethodFilter that matches {@link ModelAttribute @ModelAttribute} methods.
+ */
+ public static final MethodFilter MODEL_ATTRIBUTE_METHODS = new MethodFilter() {
+ @Override
+ public boolean matches(Method method) {
+ return (AnnotationUtils.findAnnotation(method, RequestMapping.class) == null &&
+ AnnotationUtils.findAnnotation(method, ModelAttribute.class) != null);
+ }
+ };
+
+
private List