eureka server中设置认证登录,spring cloud新老版本不同的配置(spring cloud2.0+ 和springcloud- )
注:spring cloud学习关于设置eureka server的登录认证出现问题记录
- spring cloud2.0以下版本配置:
application.yml配置:
1 security: 2 basic: 3 enabled: true 4 user: 5 name: user 6 password: password123
- spring cloud2.0以上版本配置:
application.yml配置:
1 spring: 2 application: 3 name: eureka-server 4 security: 5 user: 6 name: user 7 password: password123
注:以上两种不同的配置之后,都需要在pom.xml中添加security的依赖:
1 <dependency> 2 <groupId>org.springframework.boot</groupId> 3 <artifactId>spring-boot-starter-security</artifactId> 4 </dependency>
如果在添加登录认证出现问题,可参考:https://www.cnblogs.com/JamieLove/p/11087564.html