Spring cloud eureka 添加 spring-security

spring 版本  2.1.4

1.

问题: 添加 spring-security 后 无法注册。

原因 : spring boot 2.x 添加了 csrf 验证 。

解决 :

package boot.zero.eureka.conf;

import org.springframework.context.annotation.Configuration;
import org.springframework.security.config.annotation.web.builders.HttpSecurity;
import org.springframework.security.config.annotation.web.configuration.WebSecurityConfigurerAdapter;

@Configuration
public class SecurityConfig extends WebSecurityConfigurerAdapter {

    @Override
    protected void configure(HttpSecurity http) throws Exception {
        http.csrf().disable();
        super.configure(http);
    }
}

注册 时写法:

 

eureka:
  client:
    service-url:
      defaultZone: http://admin:admin@localhost:8080/eureka/

 

 

 

2.

问题 : /actuator/info 没有信息

解决: 执行一遍 maven 命令 spring-boot: build-info

posted on 2019-05-10 22:44  正义的伙伴!  阅读(1316)  评论(0编辑  收藏  举报

导航

//增加一段JS脚本,为目录生成使用