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".

git-svn-id: https://src.springframework.org/svn/spring-framework/trunk@3685 50f2f4bb-b051-0410-bef5-90022cba6387
This commit is contained in:
Oliver Gierke 2010-09-14 11:02:46 +00:00
parent a0c93b7e91
commit 9975f5ec19
1 changed files with 13 additions and 0 deletions

View File

@ -666,6 +666,19 @@ public class HelloWorldController {
<lineannotation>// ...</lineannotation>
&lt;/beans&gt;</programlisting>
<para>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
<interfacename>@RequestMapping</interfacename> 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
<code>proxy-target-class="true"</code> in the configuration for the
functionality applied to the controller (in our transaction scenario in
<code>&lt;tx:annotation-driven /&gt;</code>). For more information on
various proxying mechanisms see <xref linkend="aop-proxying" />.</para>
</section>
<section id="mvc-ann-requestmapping">