看起来像是default
SecurityConfiguration,它不会跳过OPTIONS的安全检查。
尝试将以下内容添加
antMatcher到中的
protected void configure(HttpSecurityhttp)方法
SecurityConfiguration.java
.antMatchers(org.springframework.http.HttpMethod.OPTIONS, "/api/**").permitAll()

看起来像是default
SecurityConfiguration,它不会跳过OPTIONS的安全检查。
尝试将以下内容添加
antMatcher到中的
protected void configure(HttpSecurityhttp)方法
SecurityConfiguration.java
.antMatchers(org.springframework.http.HttpMethod.OPTIONS, "/api/**").permitAll()