eureka注册中心设置用户名密码

1.加入安全认证依赖

<dependency> 
    <groupId>org.springframework.boot</groupId>
    <artifactId>spring-boot-starter-security</artifactId>
</dependency>

2.在application.properties加入认证的用户名和密
security.user.name=你的用户名
security.user.password=你的密码

3.在访问路径上加入用户名密码
eureka.client.serviceUrl.defaultZone=http://${security.user.name}:${security.user.password}@127.0.0.1:${server.port}/eureka/

现在访问需要输入用户名密码,访问路径格式

   
   

http://your username:your [email protected]:8761/eureka/
“`

猜你喜欢

转载自www.cnblogs.com/jpfss/p/11310731.html