Control
Control-Allow-Origin’ header is present on the requested resource. Origin ‘null’ is therefore not allowed aess 1.问题背景练手过程中,尝试使用前后端分离的技术,但不幸测试界面使用时便出错
2.问题原因 跨域请求,后端不允许可能原因,你的后台代码中没有配置相关设置,导致其默认阻止其他域的访问
我的后台使用的是springMVC模式但是没有相关配置
3.解决办法方法一,给后端加过滤器,设置相关属性
方法二,我的处理办法是在控制器中添加注解,@CrossOrigin
@CrossOrigin@.springframework.stereotype.Controllerpublic class UserController implements Controller { ... }Control