使用Spring MVC
写了个拦截器用来拦截Controller中的方法:
@Override
public void before(Method method, Object[] args, Object target)
throws Throwable {
System.out.println("---------------");
System.out.println("method.getDeclaringClass().getName() = " + method.getDeclaringClass().getName());
System.out.println("method.getName()=" + method.getName());
System.out.println("----------------");
}
配置文件:
*Controller
btnInterceptor
但是运行观察控制台发现输出结果为:
[http-8080-1] DEBUG org.springframework.web.servlet.DispatcherServlet - DispatcherServlet with name 'app' processing
request for [/weboa/safe/buildFuncTree.do]
method.getDeclaringClass().getName() = java.lang.Object
method.getName()=toString
[http-8080-1] DEBUG org.springframework.web.servlet.mvc.annotation.DefaultAnnotationHandlerMapping - Mapping
[/safe/buildFuncTree.do] to handler 'cn.edu.swu.oa.safe.controller.SafeController@571688'
[http-8080-1] DEBUG org.springframework.web.bind.annotation.support.HandlerMethodInvoker - Invoking request handler
method: public void cn.edu.swu.oa.safe.controller.SafeController.buildFuncTree
(javax.servlet.http.HttpServletRequest,javax.servlet.http.HttpServletResponse)
method.getDeclaringClass().getName() = cn.edu.swu.oa.safe.controller.SafeController
method.getName()=buildFuncTree
我不清楚
method.getDeclaringClass().getName() = java.lang.Object
method.getName()=toString
这部分是从哪来的,而且tomcat启动时也打印很多次这部分信息