Controller层的类上增加@CrossOrign注解,当前文件的所有接口就都可以被调用

spring注解@CrossOrigin不起作用的原因

1、是springMVC的版本要在4.2或以上版本才支持@CrossOrigin

2、非@CrossOrigin没有解决跨域请求问题,而是不正确的请求导致无法得到预期的响应,导致浏览器端提示跨域问题。

3、在Controller注解上方添加@CrossOrigin注解后,仍然出现跨域问题,解决方案之一就是:

在@RequestMapping注解中没有指定Get、Post方式,具体指定后,问题解决。

采纳自:https://www.cnblogs.com/mmzs/p/9167743.html

ajax跨域处理 No 'Access-Control-Allow-Origin' header is present on the requested resource 问题的更多相关文章

  1. ajax请求node.js接口时出现 No 'Access-Control-Allow-Origin' header is present on the requested resource错误

    ajax请求node.js接口出现了如下的错误: XMLHttpRequest cannot load http://xxx.xxx.xx.xx:8888/getTem?cityId=110105&a ...

  2. java、ajax 跨域请求解决方案('Access-Control-Allow-Origin' header is present on the requested resource. Origin '请求源' is therefore not allowed access.)

      1.情景展示 ajax调取java服务器请求报错 报错信息如下: 'Access-Control-Allow-Origin' header is present on the requested ...

  3. .Net Core 处理跨域问题Response to preflight request doesn't pass access control check: No 'Access-Control-Allow-Origin' header is present on the requested resource

    网页请求报错: Response to preflight request doesn't pass access control check: No 'Access-Control-Allow-Or ...

  4. (转)AJax跨域:No 'Access-Control-Allow-Origin' header is present on the requested resource

    在本地用ajax跨域访问请求时报错: No 'Access-Control-Allow-Origin' header is present on the requested resource. Ori ...

  5. ajax跨域(No 'Access-Control-Allow-Origin' header is present on the requested resource)

    问题 在某域名下使用Ajax向另一个域名下的页面请求数据,会遇到跨域问题.另一个域名必须在response中添加 Access-Control-Allow-Origin 的header,才能让前者成功 ...

  6. 跨域问题解决----NO 'Access-Control-Allow-Origin' header is present on the requested resource.Origin'http://localhost:11000' is therfore not allowed access'

    NO 'Access-Control-Allow-Origin' header is present on the requested resource.Origin'http://localhost ...

  7. js跨域访问,No 'Access-Control-Allow-Origin' header is present on the requested resource

    js跨域访问提示错误:XMLHttpRequest cannot load http://...... No 'Access-Control-Allow-Origin' header is prese ...

  8. has been blocked by CORS policy: Response to preflight request doesn't pass access control check: No 'Access-Control-Allow-Origin' header is present on the requested resource.

    前端显示: has been blocked by CORS policy: Response to preflight request doesn't pass access control che ...

  9. 解决跨域No 'Access-Control-Allow-Origin' header is present on the requested resource.

    用angular发起http.get(),访问后端web API要数据,结果chrome报错:跨域了 Access to XMLHttpRequest at 'http://127.0.0.1:300 ...

  10. No 'Access-Control-Allow-Origin' header is present on the requested resource——Web Api跨域问题

    最近使用C#写了一个简单的web api项目,在使用项目中的.cshtml文档测试的时候没有任何问题,但是在外部HBuilder上面编写.html通过Ajax调用web api路径时报错: No 'A ...

随机推荐

  1. Soap从入门到实战

    Soap从入门到实战 参考文章:https://howtodoinjava.com/spring-boot/spring-soap-client-webservicetemplate/ 使用的技术:s ...

  2. Spring Boot 集成 Ehcache 缓存,三步搞定!

    作者:谭朝红 www.ramostear.com/articles/spring_boot_ehcache.html 本次内容主要介绍基于Ehcache 3.0来快速实现Spring Boot应用程序 ...

  3. dp(传球)

    https://ac.nowcoder.com/acm/contest/1126/B 链接:https://ac.nowcoder.com/acm/contest/1126/B来源:牛客网 上体育课的 ...

  4. SCUT - 131 - 小P玩游戏II - 贪心 - 平衡树

    https://scut.online/p/131 首先假如钦定了一群人去打怪兽,那么可以把主要的任务都丢给b最大的人去打,这样不会更差.然后考虑枚举这个b最大的人,其他人陪练.一开始就是ai+k*b ...

  5. Python 内置函数raw_input()和input()用法和区别

    我们知道python接受输入的raw_input()和input() ,在python3 输入raw_input() 去掉乐,只要用input() 输入,input 可以接收一个Python表达式作为 ...

  6. 什么是dockerfile?

    什么是dockerfile? Dockerfile是一个包含用于组合映像的命令的文本文档.可以使用在命令行中调用任何命令. Docker通过读取Dockerfile中的指令自动生成映像. docker ...

  7. 3-基于双TMS320C6678+双XC6VSX315T的6U VPX高速数据处理平台

    基于双TMS320C6678+双XC6VSX315T的6U VPX高速数据处理平台   一.板卡概述 板卡由我公司自主研发,基于VPX架构,主体芯片为两片 TI DSP TMS320C6678,两片V ...

  8. Linux性能优化从入门到实战:08 内存篇:内存基础

    内存主要用来存储系统和应用程序的指令.数据.缓存等. 内存映射   物理内存也称为主存,动态随机访问内存(DRAM).只有内核才可以直接访问物理内存.   Linux 内核给每个进程都提供了一个独立的 ...

  9. Hugin

    Hugin简介 Hugin是一个开源的拼接软件,包含大量的拼接所需模块源码以及使用了部分Panorama Tools中的工具. 1)libpano13(Panorama Tools). 2)cpfin ...

  10. RABBITMQ 协议 AMQP协议

    https://baike.baidu.com/item/rabbitmq/9372144?fr=aladdin https://github.com/CopernicaMarketingSoftwa ...