禁用 csrf 即可
httpSecurity.csrf(csrf -> csrf.disable());
@Configuration
public class SecurityConfig {/*** 认证管理器** @param authenticationConfiguration* @return* @throws Exception*/@Beanpublic AuthenticationManager authenticationManager(AuthenticationConfiguration authenticationConfiguration) throws Exception {return authenticationConfiguration.getAuthenticationManager();}@Beanpublic SecurityFilterChain securityFilterChain(HttpSecurity httpSecurity) throws Exception {httpSecurity.authorizeHttpRequests((auth) -> auth.anyRequest().permitAll());httpSecurity.csrf(csrf -> csrf.disable());return httpSecurity.build();}}