https://blog.csdn.net/fly910905/article/details/78580895
- 方式1-关闭验证
application.properties添加配置参数management.security.enabled=false
- 方式2-开启HTTP basic认证
- 添加依赖
<dependency><groupId>org.springframework.boot</groupId><artifactId>spring-boot-starter-security</artifactId></dependency>
- application.properties 添加用户名和密码
security.user.name=adminsecurity.user.password=123456management.security.enabled=truemanagement.security.role=ADMIN
- 访问URL http://localhost:8080/env 后,就看到需要输入用户名和密码了。