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".
This commit is contained in:
parent
bf90a2ddb6
commit
2c559aa8c8
|
@ -666,6 +666,19 @@ public class HelloWorldController {
|
|||
<lineannotation>// ...</lineannotation>
|
||||
|
||||
</beans></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><tx:annotation-driven /></code>). For more information on
|
||||
various proxying mechanisms see <xref linkend="aop-proxying" />.</para>
|
||||
</section>
|
||||
|
||||
<section id="mvc-ann-requestmapping">
|
||||
|
|
Loading…
Reference in New Issue