Springboot 跨域配置报错


报错:java.lang.IllegalArgumentException: When allowCredentials is true,

allowedOrigins cannot contain the special value "*"since that cannot be set on the "Access-Control-Allow-Origin"

response header. To allow credentials to a set of origins, list them explicitly or consider using "allowedOriginPatterns" instead.

原因:springboot升级2.4.0后所出现的问题

解决方法:将.allowedOrigins 替换成. allowedOriginPatterns 即可。