eureka注册中心设置用户名密码,引用相应的依赖
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-security</artifactId>
</dependency>
版本不同配置文件有差别吗
例如:springboot版本用2.0.0.M3
application.yml 配置文件需这样写:
security:
user:
name:你的用户名
password:你的密码
在访问路径上加入用户名密码
eureka:
client:
serviceUrl:
defaultZone:http://你的用户名:你的密码@127.0.0.1:8761/eureka/
对应的client端的url也要改为一样的,能注册上去
springBoot版本用2.0.3.RELEASE
application.yml 配置文件需改写为:
spring:
security:
user:
name:你的用户名
password:你的密码
如果改为之前的配置文件会报错

client端就不能注册上去

SpringCloud组件实现微服务,【已升级Finchley.Release】
了解课程