在spring5.3之后,使用
corsConfiguration.addAllowedOrigin("*");
会抛出异常
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.
引起在5.3之后,引入了
corsConfiguration.addAllowedOriginPattern("*")
所以请替换使用