在我的基於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在我的應用
你檢查做以下的方法是什麼? –