SpringBoot 3.3.3以上版本CORS配置失效

仅就本人项目而言,有错误请指正

 原本Springboot 版本为3.2.5. 升级成4.3.3之后,除了登录请求之外,所有请求都报错 CORS

经过Debug 发现在3.3.3 的版本,filterChain中没有 corsFilter 

找到corsFilter。将逻辑copy到 自定义的JwtAuthenticationFilter 中,问题暂时解决

### Spring Boot 3.3.3 Compatible Versions of Spring Security and OAuth2 Dependencies For ensuring compatibility between different components within the Spring ecosystem, it is important to align dependency versions properly. With regard to using Spring Boot version `3.3.3`, specific versions of Spring Security and related OAuth2 libraries should be chosen carefully. The recommended approach for determining compatible versions involves leveraging the Spring Initializr or consulting the official documentation which provides guidance on dependency management. For Spring Boot `3.3.3`, one can refer to the release notes and updates provided by the community[^1]. Typically, when a new major version like this comes out, there will also be corresponding releases from other projects such as Spring Security that are tested together with this particular Spring Boot version. To specify these dependencies directly in your project&#39;s build configuration file (for Maven), an example would look something like: ```xml <dependencyManagement> <dependencies> <!-- Other managed versions --> <dependency> <groupId>org.springframework.boot</groupId> <artifactId>spring-boot-dependencies</artifactId> <version>3.3.3</version> <type>pom</type> <scope>import</scope> </dependency> <dependency> <groupId>org.springframework.security.oauth.boot</groupId> <artifactId>spring-security-oauth2-autoconfigure</artifactId> <version>${compatible.version}</version> </dependency> </dependencies> </dependencyManagement> ``` In Gradle, you might configure similarly but through the use of plugins and dependency configurations: ```groovy plugins { id &#39;org.springframework.boot&#39; version &#39;3.3.3&#39; } dependencies { implementation(&#39;org.springframework.security:spring-security-config&#39;) implementation(&#39;org.springframework.security.oauth.boot:spring-security-oauth2-autoconfigure:${compatibleVersion}&#39;) } ``` It must be noted here that `${compatible.version}` needs replacement with actual values found either via checking against BOMs (Bill Of Materials) included under `<dependencyManagement>` tags in POM files or looking up at [Spring IO Platform](https://start.spring.io/actuator/info).
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值