springboot升级2.1.1.RELEASE-》2.7.x

1、springboot2.6.0以后将SpringMVC默认路径匹配策略从AntPathMatcher更改为PathPatternParser,导致出错,解决办法是切换回原先的AntPathMatcher。

配置文件加上

spring.mvc.pathmatch.matching-strategy=ant_path_matcher

2、跨域异常


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不再可用,将配置中的.allowedOrigins替换成.allowedOriginPatterns即可。


2024.1.16   /   热度:259   /   分类: java

发表评论:

©地球仪的BLOG  |  Powered by Emlog