问题描述:
Eureka Client 无法在Server 端注册,报failure with status code 403; retrying on another server if available
根源:
Eureka 默认启用了csrf检验,可以将其disable调,需要要在eureka Server端新建一个WebSecurityConfigurerAdapter的继承,并加上@EnableWebSecurity注解:
@EnableWebSecurity
public class WebSecurityConfigurer extends WebSecurityConfigurerAdapter {
@Override
protected void configure(HttpSecurity http) throws Exception {
http.csrf().disable();
super.configure(http);
}
}