在我的基于spring mvc和spring security的应用程序中,我使用了@Controller
注释来配置控制器。如何在Spring Interceptor preHandle方法中获取控制器方法名称
我已经配置春处理器拦截和preHandle()
方法,我想这将是由拦截器调用方法名。
我想获得在控制器方法preHandle()
方法HandlerInterceptor
上定义的自定义注释,以便我可以通过记录该特定方法的活动来进行管理。
请看看我的应用需求和代码
@Controller
public class ConsoleUserManagementController{
@RequestMapping(value = CONSOLE_NAMESPACE + "/account/changePassword.do", method = RequestMethod.GET)
@doLog(true)
public ModelAndView showChangePasswordPage() {
String returnView = USERMANAGEMENT_NAMESPACE + "/account/ChangePassword";
ModelAndView mavChangePassword = new ModelAndView(returnView);
LogUtils.logInfo("Getting Change Password service prerequisit attributes");
mavChangePassword.getModelMap().put("passwordModel", new PasswordModel());
return mavChangePassword;
}
}
public boolean preHandle(HttpServletRequest request, HttpServletResponse response, Object handler) throws Exception {
// here I want the controller method name(i.e showChangePasswordPage()
// for /account/changePassword.do url) to be called and that method annotation
// (i.e doLog()) so that by viewing annotation , I can manage whether for that
// particular controller method, whether to enable logging or not.
}
我使用Spring 3.0在我的应用
你检查做以下的方法是什么? –