来自于stackoverflow问题的整理

只需要在工程中依赖 org.springframework.boot:spring-boot-starter-security

在bootstrap.yml中添加以下配置即可

security:
  basic:
    enabled: true
  user:
    name: ctp_config
    password: ctp_config


更为详细的描述

在Eureka server中放置如下配置

security:
  basic:
    enabled: true
  user:
      name: user # login username
      password: password

在服务配置中增加一下配置

eureka:
  client:
    registerWithEureka: true
    fetchRegistry: true
    serviceUrl:
      defaultZone: http://user:password@localhost:8761/eureka/



Logo

权威|前沿|技术|干货|国内首个API全生命周期开发者社区

更多推荐