有时,尤其是在初始测试期间,默认情况下,Spring的 csrf- 跨站点请求伪造-保护会默认启动并阻止POST请求的发生,一种 临时的
解决方法是禁用 csrf 。这通常是在Web安全配置类中完成的,该类扩展了WebSecurityConfigurerAdapter
@EnableWebSecuritypublic class WebSecurityConfig extends WebSecurityConfigurerAdapter { @Override protected void configure(HttpSecurity http) throws Exception { http .csrf().disable(); }}注意:这与 Spring Boot 2.0.0.RC1 上的 版本相同 ,如果 不能 永久使用,则最好



