我有一个带有 @Controller 和 @RequestMapping 注释的控制器。
@Controller
@RequestMapping(value = "/copyRightVersion")
public class CopyrightAndVersionController extends BaseController {
protected CopyrightAndVersionController() {
super(CopyrightAndVersionController.class);
}
/**
* Reads copyright and version from respective files.
*
* @return the model and view
*/
@RequestMapping(value = "/getVersion", method = RequestMethod.GET)
public ModelAndView getCopyrightAndVersion() {
LOGGER.debug("in getCopyrightAndVersion method");
ModelAndView mav = new ModelAndView("copyrightAndVersion");
mav.getModelMap().put("copyright", "test copyright");
mav.getModelMap().put("version", "test version");
return mav;
}
}
在日志中我看到
DispatcherServlet with name 'xtreme' processing GET request for [/Xtreme/copyRightVersion/getVersion.do]
Looking up handler method for path /copyRightVersion/getVersion.do
Returning handler method [public org.springframework.web.servlet.ModelAndView com.xtreme.controller.CopyrightAndVersionController.getCopyrightAndVersion()]
tableBeanFactory] - Returning cached instance of singleton bean 'copyrightAndVersionController'
Last-Modified value for [/Xtreme/copyRightVersion/getVersion.do] is: -1
Successfully completed request
尽管 DispatcherServlet 为此正确识别了处理程序,但它从未命中控制器的方法 getCopyrightAndVersion()。它不会在日志中打印消息。即使在远程调试中也不会被击中。
我错过了什么吗?