From 5f166f6799b248fb51f2cf77b522ccd0dcba36db Mon Sep 17 00:00:00 2001 From: Juergen Hoeller Date: Thu, 4 Feb 2010 15:52:15 +0000 Subject: [PATCH] added warning about annotated controller interfaces (SPR-6655) --- .../web/bind/annotation/RequestMapping.java | 7 ++++++- .../web/bind/annotation/SessionAttributes.java | 7 ++++++- spring-framework-reference/src/mvc.xml | 9 +++++++++ 3 files changed, 21 insertions(+), 2 deletions(-) diff --git a/org.springframework.web/src/main/java/org/springframework/web/bind/annotation/RequestMapping.java b/org.springframework.web/src/main/java/org/springframework/web/bind/annotation/RequestMapping.java index e63d72988f7..7e001314dcb 100644 --- a/org.springframework.web/src/main/java/org/springframework/web/bind/annotation/RequestMapping.java +++ b/org.springframework.web/src/main/java/org/springframework/web/bind/annotation/RequestMapping.java @@ -1,5 +1,5 @@ /* - * Copyright 2002-2009 the original author or authors. + * Copyright 2002-2010 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. @@ -168,6 +168,11 @@ import java.lang.annotation.Target; * and/or AnnotationMethodHandlerAdapter is defined as well * - provided that you intend to use @RequestMapping. * + *

NOTE: When using controller interfaces (e.g. for AOP proxying), + * make sure to consistently put all your mapping annotations - such as + * @RequestMapping and @SessionAttributes - on + * the controller interface rather than on the implementation class. + * * @author Juergen Hoeller * @author Arjen Poutsma * @author Sam Brannen diff --git a/org.springframework.web/src/main/java/org/springframework/web/bind/annotation/SessionAttributes.java b/org.springframework.web/src/main/java/org/springframework/web/bind/annotation/SessionAttributes.java index 076bec779be..ec9138f0ac1 100644 --- a/org.springframework.web/src/main/java/org/springframework/web/bind/annotation/SessionAttributes.java +++ b/org.springframework.web/src/main/java/org/springframework/web/bind/annotation/SessionAttributes.java @@ -1,5 +1,5 @@ /* - * Copyright 2002-2008 the original author or authors. + * Copyright 2002-2010 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. @@ -43,6 +43,11 @@ import java.lang.annotation.Target; * Alternatively, consider using the attribute management capabilities of the * generic {@link org.springframework.web.context.request.WebRequest} interface. * + *

NOTE: When using controller interfaces (e.g. for AOP proxying), + * make sure to consistently put all your mapping annotations - such as + * @RequestMapping and @SessionAttributes - on + * the controller interface rather than on the implementation class. + * * @author Juergen Hoeller * @since 2.5 */ diff --git a/spring-framework-reference/src/mvc.xml b/spring-framework-reference/src/mvc.xml index e19e3b56068..72fc1e14393 100644 --- a/spring-framework-reference/src/mvc.xml +++ b/spring-framework-reference/src/mvc.xml @@ -1390,6 +1390,15 @@ public class EditPetForm { public class EditPetForm { // ... } + + + When using controller interfaces (e.g. for AOP proxying), make sure to + consistently put all your mapping annotations - such as + @RequestMapping and + @SessionAttributes - on the controller + interface rather than on the implementation class. + +