Skip to content

Instantly share code, notes, and snippets.

@arganzheng
Last active December 20, 2015 01:49
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save arganzheng/6051885 to your computer and use it in GitHub Desktop.
Save arganzheng/6051885 to your computer and use it in GitHub Desktop.

Spring interceptor

配置

<!-- Configures Handler Interceptors --> 
<mvc:interceptors>  
    <!-- This bit of XML will intercept all URLs - which is what you want in a web app -->
    <bean class="me.arganzheng.study.api.container.interceptor.AuthorizationInterceptor" />
     
    <!-- This bit of XML will apply certain URLs to certain interceptors -->
    <mvc:interceptor>
        <mvc:mapping path="/admin/**"/>
        <bean class="me.arganzheng.study.api.container.interceptor.RequestInitializeInterceptor" />
    </mvc:interceptor>
</mvc:interceptors>

参考文章

  1. Using Spring Interceptors in your MVC Webapp
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment