来自于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

云原生社区为您提供最前沿的新闻资讯和知识内容

更多推荐