Eureka控制台设置访问密码

Eureka控制台设置访问密码

  •  2019 年 3 月 5 日
  •  602
  •  Java SpringCloud 

需要的依赖

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

server配置文件

server:
  port: 8761

eureka:
  instance:
    hostname: localhost
  client:
    register-with-eureka: false
    fetch-registry: false
    service-url:
      defaultZone: http://${eureka.instance.hostname}:${server.port}/eureka/
security:
  basic:
    enabled: true
  user:
    name: admin
    password: password

client配置文件

spring:
  application:
    name: client-eureka

server:
  port: 8762

eureka:
  instance:
    hostname: localhost
  client:
    service-url:
      defaultZone: http://admin:password@localhost:8761/eureka/

效果


扫一扫分享到微信

已有 条评论
写评论