【发布时间】:2018-05-10 06:51:08
【问题描述】:
我正在使用 springMVC 应用程序。我有一个请求映射,它直接返回一个视图而不处理中间的行。
@RequestMapping(value = { "/testCnt" }, method = { RequestMethod.GET })
public ModelAndView testContent(HttpServletRequest request) {
log.debug("testing debug");
ModelAndView mnv = new ModelAndView();
log.debug("testssss");
log.debug("test purpose");
//some procesing here....Calling other methods and doing the required process
........
........
mnv.setViewName("returnjsp");
return mnv;
}
所以对于上面的代码,我可以在日志语句中看到以下内容:
2017-11-26 22:01:56,388 DEBUG org.springframework.web.servlet.DispatcherServlet DispatcherServlet with name 'SiteServlet' processing GET request for [/mysite/site/ContentTest/testCnt]
2017-11-26 22:01:56,389 DEBUG org.springframework.web.servlet.mvc.method.annotation.RequestMappingHandlerMapping Looking up handler method for path /ContentTest/testCnt
2017-11-26 22:01:56,394 DEBUG org.springframework.web.servlet.mvc.method.annotation.RequestMappingHandlerMapping Returning handler method [public org.springframework.web.servlet.ModelAndView myproject.org.com.TestCountController.testContent(javax.servlet.http.HttpServletRequest)]
2017-11-26 22:01:56,394 DEBUG org.springframework.beans.factory.support.DefaultListableBeanFactory Returning cached instance of singleton bean 'testCountController'
2017-11-26 22:01:56,401 DEBUG org.springframework.web.servlet.DispatcherServlet Last-Modified value for [/portal/site/ContentTest/testCnt
] is: -1
2017-11-26 22:01:58,850 DEBUG org.springframework.beans.factory.support.DefaultListableBeanFactory Invoking afterPropertiesSet() on bean with name 'returnjsp'
我没有在日志中看到我的日志语句,这是执行的第一行。它直接将视图返回给“returnjsp”,而不处理该方法中的内容。请帮忙
【问题讨论】:
-
请添加相关代码。在给定的解释中很难解释。
-
@PraJazz 添加了完整示例。请建议
-
能否包含日志配置。
-
它处于调试模式,我可以看到其他请求映射的日志语句。非常不知道为什么我看不到这个日志语句:(@PraJazz
标签: java spring spring-mvc