https://blog.csdn.net/fly910905/article/details/78580895

 

  • 方式1-关闭验证 
  1. application.properties添加配置参数
  2. management.security.enabled=false
  • 方式2-开启HTTP basic认证 
    • 添加依赖    
  1. <dependency>
  2. <groupId>org.springframework.boot</groupId>
  3. <artifactId>spring-boot-starter-security</artifactId>
  4. </dependency>
  • application.properties 添加用户名和密码
  1. security.user.name=admin
  2. security.user.password=123456
  3. management.security.enabled=true
  4. management.security.role=ADMIN
  • 访问URL http://localhost:8080/env 后,就看到需要输入用户名和密码了。 
posted on 2018-04-13 18:04  1161588342  阅读(529)  评论(0编辑  收藏  举报