新版(2.x版本)的security默认启用了csrf检验,要在eureka服务端那边配置security的csrf检验为false
在server端,编写如下代码,再重启server和client
@EnableWebSecurity
public class WebSecurityConfigurer extends WebSecurityConfigurerAdapter {
@Override
protected void configure(HttpSecurity http) throws Exception {
http.csrf().disable();
super.configure(http);
}
}
客户端注册eureka服务失败registration failed Cannot execute request on any known server
最新推荐文章于 2023-08-09 12:54:04 发布