一、添加spring-security支持
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-security</artifactId>
</dependency>
二、在配置文件中加入安全认证
# 安全认证的配置
security:
basic:
enabled: true
user:
name: chhliu # 用户名
password: chhliu123456 # 用户密码
eureka:
client:
register-with-eureka: false
fetch-registry: false
service-url:
defaultZone: http://chhliu:chhliu123456@localhost:8761/eureka # 安全的注册地址
网友评论