From 2c559aa8c885a23df67e4607e604c17204db9c84 Mon Sep 17 00:00:00 2001 From: Oliver Gierke Date: Tue, 14 Sep 2010 11:02:46 +0000 Subject: [PATCH] SPR-7537 - Document proxying for MVC controllers Extended documentation to include hints on what to consider when working with proxied controllers. Explained the necessity of moving @RequestMapping annotations to the interface or use proxy-target- class="true". --- spring-framework-reference/src/mvc.xml | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/spring-framework-reference/src/mvc.xml b/spring-framework-reference/src/mvc.xml index 278f7b0f4d..4978054b37 100644 --- a/spring-framework-reference/src/mvc.xml +++ b/spring-framework-reference/src/mvc.xml @@ -666,6 +666,19 @@ public class HelloWorldController { // ... </beans> + + A common pitfall when working with annotated controller classes is + a scenario where you want apply functionality to it that involves + creating a proxy for the controller object (transactional controllers + e.g.). Usually you will introduce an interface for the controller then + to use JDK dynamic proxies. To make this work you have to move the + @RequestMapping annotations to the + interface as well as the mapping lookup only "sees" the interface + exposed by the proxy then. An alternative might be to activate + proxy-target-class="true" in the configuration for the + functionality applied to the controller (in our transaction scenario in + <tx:annotation-driven />). For more information on + various proxying mechanisms see .