gpt4 book ai didi

spring - 来源 http ://localhost:4200 has been blocked by CORS policy error in browser when tried to call Spring REST end point in angular

转载 作者:行者123 更新时间:2023-12-05 02:35:18 25 4
gpt4 key购买 nike

尝试以角度调用 Spring 支撑端点时出现以下错误。

Origin http://localhost:4200 has been blocked by CORS policy: No 'Access-Control-Allow-Origin' header is present on the requested resource

错误图片: enter image description here

最佳答案

解决方案:在相应的 Controller 类顶部添加@CrossOrigin("*") 注释。

enter image description here

关于spring - 来源 http ://localhost:4200 has been blocked by CORS policy error in browser when tried to call Spring REST end point in angular,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/70604768/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com