Spring MVC如何添加自定义注解
Can anyone explain what I need to do to implement my own annotation that would add functionality to my web requests?
For example:
@Controller public class MyController { @RequestMapping("/abc") @RequiresSomeSpecialHandling public void handleSecureRequest() { } }
Here @RequiresSomeSpecialHandling would be my own annotation that causes some special work to be done before or after the given web request /abc.
I know that on a very high level I would need to write a bean post processor, scan classes for my annotations, and inject custom mvc interceptors when needed. But are there any shortcuts to simplify this task? Especially for the two examples above.
Thanks in advance,
Spring框架介绍
Can anyone explain what I need to do to implement my own annotation that would add functionality to my web requests?
For example:
@Controller public class MyController { @RequestMapping("/abc") @RequiresSomeSpecialHandling public void handleSecureRequest() { } }
Here @RequiresSomeSpecialHandling would be my own annotation that causes some special work to be done before or after the given web request /abc.
I know that on a very high level I would need to write a bean post processor, scan classes for my annotations, and inject custom mvc interceptors when needed. But are there any shortcuts to simplify this task? Especially for the two examples above.
Thanks in advance,
http://luju.me/spring/reference/overview.html