在spring-mvc.xml中添加如下配置
<bean class="org.springframework.web.servlet.mvc.method.annotation.RequestMappingHandlerMapping" />
<bean class="org.springframework.web.servlet.mvc.method.annotation.RequestMappingHandlerAdapter" p:ignoreDefaultModelOnRedirect="true">
<property name="messageConverters">
<ref bean="mappingJacksonHttpMessageConverter" />
<mvc:interceptors>
<mvc:interceptor>
<mvc:mapping path="/**"/>
<bean class="com.menglong.interceptor.CompanyInterceptor" />
</mvc:interceptor>
</mvc:interceptors>