RequestMapping和Controller注释。控制器没有被击中

时间:2013-08-26 10:17:00

标签: spring model-view-controller spring-mvc controller spring-annotations

我有一个带@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正确识别了此处理程序,但它永远不会触及Controller的方法getCopyrightAndVersion()。它不会在日志中打印消息。即使在远程调试中也没有被击中。

我错过了什么吗?

0 个答案:

没有答案