• Spring MVC如何添加自定義注解

    0
    HTML Spring MVC C/C++ Go 27220 次瀏覽

    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

    相似問題

    相關經驗

    相關資訊

    相關文檔

  • sesese色