Spring Boot的版本高于 2.4以后 ,原来的配置已经不适合目前的版本

将代码中的allowedOrigins改为allowedOriginPatterns


@Configuration
public class WebConfig implements WebMvcConfigurer { /**
* 跨域支持
*
* @param registry
*/
@Override
public void addCorsMappings(CorsRegistry registry) {
registry.addMapping("/**")
.allowedOrigins("*")
.allowedMethods("GET", "HEAD", "POST", "PUT", "DELETE", "OPTIONS")
.allowCredentials(true)
.maxAge(3600)
.allowedHeaders("*");
} }

修改后

@Configuration
public class WebConfig implements WebMvcConfigurer { /**
* 跨域支持
*
* @param registry
*/
@Override
public void addCorsMappings(CorsRegistry registry) {
registry.addMapping("/**")
.allowedOriginPatterns("*")
.allowedMethods("GET","HEAD","POST","PUT","DELETE","OPTIONS")
.allowCredentials(true)
.maxAge(3600)
.allowedHeaders("*");
} }

allowedOrigins cannot contain the special value "*"的更多相关文章

  1. HDU 4569 Special equations(取模)

    Special equations Time Limit:1000MS     Memory Limit:32768KB     64bit IO Format:%I64d & %I64u S ...

  2. (转载)phpcms v9两步实现专题栏目生成路径去掉html和special

    相信很多人都知道,phpcms v9专题是不支持自定义URL的,生成的专题路径是以/HTML/special/开头的.那么如何实现专题栏目生成路径去掉html和special呢?通过修改程序的PHP源 ...

  3. QIBO CMS SQL Injection Via Variable Uninitialization In \member\special.php

    Catalog . 漏洞描述 . 漏洞触发条件 . 漏洞影响范围 . 漏洞代码分析 . 防御方法 . 攻防思考 1. 漏洞描述 该漏洞存在于/member/special.php文件下,由于未对变量进 ...

  4. Jquery报错:Uncaught TypeError: ((m.event.special[e.origType] || (intermediate value)).handle || e.handler).apply is not a function

    页面中出现了Jquery报错:Uncaught TypeError: ((m.event.special[e.origType] || (intermediate value)).handle || ...

  5. poj-3739. Special Squares(二维前缀和)

    题目链接: I. Special Squares There are some points and lines parellel to x-axis or y-axis on the plane. ...

  6. 【教程】如何正确的写一个Lemon/Cena的SPJ(special judge)

    转自:http://www.cnblogs.com/chouti/p/5752819.html Special Judge:当正确的输出结果不唯一的时候需要的自定义校验器 首先有个框架 #includ ...

  7. CodeForces 219B Special Offer! Super Price 999 Bourles!

    Special Offer! Super Price 999 Bourles! Time Limit:1000MS     Memory Limit:262144KB     64bit IO For ...

  8. Codeforces Round #249 (Div. 2) D. Special Grid 枚举

    题目链接: http://codeforces.com/contest/435/problem/D D. Special Grid time limit per test:4 secondsmemor ...

  9. Project Euler 106:Special subset sums: meta-testing 特殊的子集和:元检验

    Special subset sums: meta-testing Let S(A) represent the sum of elements in set A of size n. We shal ...

  10. Project Euler P105:Special subset sums: testing 特殊的子集和 检验

    Special subset sums: testing Let S(A) represent the sum of elements in set A of size n. We shall cal ...

随机推荐

  1. 用强数据类型保护你的表单数据-基于antd表单的类型约束

    概述 接口数据类型与表单提交数据类型,在大多数情况下,大部分属性的类型是相同的,但很少能做到完全统一. 我在之前的工作中经常为了方便,直接将接口数据类型复用为表单内数据类型,在遇到属性类型不一致的情况 ...

  2. 新手VSCode配置C++20

    最近买了本C++20的书,想要自己配置下在VScode的环境 例子代码: #include <iostream> #include <format> int main() { ...

  3. 2021年前端面试题——JS

    目录: DOM事件流有那些阶段? 解释事件冒泡以及如何阻止它? 事件委派/事件委托是什么? 如何理解 JS 中的this关键字? 更改this指向的方法有那些? apply.call.bind 区别? ...

  4. Pipeline模式应用

    本文记录Pipeline设计模式在业务流程编排中的应用 前言 Pipeline模式意为管道模式,又称为流水线模式.旨在通过预先设定好的一系列阶段来处理输入的数据,每个阶段的输出即是下一阶段的输入. 本 ...

  5. 浅谈SQL优化小技巧

    回顾MySQL的执行过程,帮助介绍如何进行sql优化. (1)客户端发送一条查询语句到服务器: (2)服务器先查询缓存,如果命中缓存,则立即返回存储在缓存中的数据: (3)未命中缓存后,MySQL通过 ...

  6. C# 常量 结构体 委托

    常量 const double PI = 3.1415926; 常量名命名一般使用大写字母 枚举类型 开发一个游戏,游戏角色有法师(Mage).射手(Archer).刺客(Assassin).坦克(T ...

  7. 如何根据月份查询每月Xxx的总数

    我以我的项目根据月份查询每月新增会员的总数为例 Controller @GetMapping("/getMemberReport.do") public R getMemberRe ...

  8. keycloak~从login-status-iframe页面总结如何跨域传值~续

    keycloak~从login-status-iframe相关文章,可阅读我的这两篇keycloak~从login-status-iframe页面总结如何跨域传值,keycloak~对接login-s ...

  9. 聊聊流式数据湖Paimon(五)

    从Demo入手,了解Paimon/Flink项目搭建的全过程.记录下采坑之旅. 创建Flink项目 在IDEA中创建Flink项目,由于没有Flink的archetype,因此需要手动创建一下. 参考 ...

  10. DVWA Command Injection(命令注入)全等级

    Command Injection(命令注入) 目录: Command Injection(命令注入) 1. Low 利用 1.nc反弹shell 2.msf上马 2.Medium 3. High 4 ...