异常信息
异常原因
这是由于eureka的版本过高,并且在pom文件引入了security,然后eureka高版本默认开启csrf保护。
解决办法
因此我们需要在eureka服务端关闭csrf校验,具体操作如下:
1.在eureka服务端新建一个类;
2.然后加上以下代码即可:
@EnableWebSecurity
public class WebSecurityConfig extends WebSecurityConfigurerAdapter {
@Override
protected void configure(HttpSecurity http) throws Exception {
http.csrf().disable();
super.configure(http);
}
}
3.最后重启服务就发现不在报错了。