Eureka的Server端開啟驗證后诈茧,其他接口無法向注冊中心注冊
百度后,發(fā)現Spring Cloud 2.0 以上的security默認啟用了csrf檢驗墓拜,要在eurekaServer端配置security的csrf檢驗為false
@EnableWebSecurity
public class WebSecurityConfig extends WebSecurityConfigurerAdapter {
@Override
protected void configure(HttpSecurity http) throws Exception {
http.csrf().disable();// 關閉csrf檢驗
super.configure(http);
}
}