开发者社区 问答 正文

idea更新后spring报警告

今天我把IntelliJ IDEA更新到14.0.3之后项目就一直报这个警告,请问如何解决

一月 29, 2015 6:09:04 下午 org.springframework.web.servlet.PageNotFound handleHttpRequestMethodNotSupported
警告: Request method 'HEAD' not supported
一月 29, 2015 6:09:04 下午 org.springframework.web.servlet.PageNotFound handleHttpRequestMethodNotSupported
警告: Request method 'HEAD' not supported

展开
收起
a123456678 2016-03-17 16:15:33 2736 分享 版权
1 条回答
写回答
取消 提交回答
  • 主要原因是:选中after launch,idea在项目启动完成后,会通过method为HEAD的方式去请求主页,如果返回失败,会自动不断重试的。遇到这个问题的两个解决办法为:

    去掉after launch选项,就不会有这个问题;
    在自己的主页的请求上,增加对HEAD的支持,如果主页有自动跳转,如跳转到登录页面,也需要把跳转的页面加上。用Spring MVC的代码如下:
    `
    @RequestMapping(value = "/", method = {RequestMethod.GET, RequestMethod.HEAD})
    `

    2019-07-17 19:05:36
    赞同 展开评论