请不要在我面前骚 2022-09-11 21:13 采纳率: 100%
浏览 22
已结题

指定PostMapping的name属性会让我的静态资源/static/没办法访问

我在写接口的时候用了@PostMapping(name = "")。指定PostMapping的name属性会让我的静态资源/static/没办法访问。有没有知道这是为什么呀。
@CrossOrigin
@PostMapping(value = "api/upLoad")
// TODO @PostMapping(name = "api/upLoad") name属性会导致静态资源没办法访问
@ResponseBody
public Result upLoad(@RequestParam("file")MultipartFile file) {
错误提示:Whitelabel Error Page

This application has no explicit mapping for /error, so you are seeing this as a fallback.

Sun Sep 11 21:09:12 CST 2022
There was an unexpected error (type=Method Not Allowed, status=405).
Request method 'GET' not supported
org.springframework.web.HttpRequestMethodNotSupportedException: Request method 'GET' not supported

  • 写回答

1条回答 默认 最新

  • 小白敲代码 2022-09-13 11:56
    关注

    可以试下ResquestMapping,或者在配置文件中不拦截静态资源,如有帮助请采纳

    本回答被题主选为最佳回答 , 对您是否有帮助呢?
    评论

报告相同问题?

问题事件

  • 系统已结题 9月26日
  • 已采纳回答 9月18日
  • 创建了问题 9月11日