開發中遇到的問題,須要在filter中對requestURI作處理,須要用到自定義註解。web
Filter的生命週期先於springMvcServlet建立因此無效spring
spring xml 中加入app
<bean id="xxxFilter" class="xxx.xxxFilter" />
web.xmlasync
<filter> <filter-name>DelegatingFilterProxy</filter-name> <filter-class>org.springframework.web.filter.DelegatingFilterProxy</filter-class> <async-supported>true</async-supported> <init-param> <param-name>targetBeanName</param-name> <param-value>xxxFilter</param-value> </init-param> <init-param> <param-name>targetFilterLifecycle</param-name> <param-value>true</param-value><!--保留init destroy方法--> </init-param> </filter> <filter-mapping> <filter-name>DelegatingFilterProxy</filter-name> <url-pattern>/*</url-pattern> </filter-mapping>