mardi 31 mars 2015

Interceptor in Spring4 does not work

I am using Spring MVC 4.1.4 in my application, and I found that the Interceptor does not work as expected, it seems that the interceptor does not even get invoked:



public class AutheInterceptor implements HandlerInterceptor {
@Autowired
private UserService userService;
@Override
public boolean preHandle(HttpServletRequest request, HttpServletResponse response, Object handler) throws Exception {
User user = userService.getUser();
return user != null;
}
//other methods omitted
}


And the mvc configuration(part):



<mvc:interceptors>
<mvc:interceptor>
<mvc:mapping path="*"/>
<bean class="com.app.interceptor.AutheInterceptor">
<property name="userService" ref="userService"/>
</bean>
</mvc:interceptor>
</mvc:interceptors>


Full configuration: http://ift.tt/1FfK1lu


I have searched at google and sf, but I can not find anything helpful.


Aucun commentaire:

Enregistrer un commentaire