在公司开发过程中,一个前后端分离的项目遇见了跨域的问题. 前端控制台报错:No 'Access-Control-Allow-Origin' header is present on the requested resource. 从经验得知:spring boot解决跨域问题.两种解决方法: 1.重写 WebMvcConfigurer 类,并注入到spring容器中: @Configuration public class CustomCorsConfiguration implements W…
问题描述 No 'Access-Control-Allow-Origin' header is present on the requested resource. Origin 'http://127.0.0.1:8020' is therefore not allowed access. 参考博客 Spring MVC通过CROS协议解决跨域问题 作者原文链接:http://www.imooc.com/article/7719 spring 官方文档: 链接:https://docs.spr…