Spring MVC interceptor (HandlerInterceptor) preHandle a request is executed twice

Spring MVC interceptor (HandlerInterceptor) preHandle a request is executed twice

 

Due to the wrong way of writing the loading xml configuration file in web.xml, some xmls are loaded twice.

Wrong spelling:

<servlet>

      <servlet-name>springmvc</servlet-name>

          <servlet-class>org.springframework.web.servlet.DispatcherServlet</servlet-class>

      <init-param>

                  <param-name>contextConfigLocation</param-name>

                  <param-value>classpath*:applicationContext-*.xml</param-value>

      </init-param>

      <load-on-startup>1</load-on-startup>

</servlet>

In fact, there is one more * after the classpath * remove this * and it will be OK.

 

For the difference between classpath*: and classpath: see: http://blog.csdn.net/nba_2011/article/details/7989999

Guess you like

Origin http://43.154.161.224:23101/article/api/json?id=325700183&siteId=291194637