spring-boot 401 Full authentication is required to access this resource错误解觉

1. 关闭验证

          在yml文件中加上  management.security.enabled: false

2.开启HTTP basic认证 

maven:

 

org.springframework.boot

spring-boot-starter-securityifactId>

gradle:

compile("org.springframework.cloud:spring-cloud-starter-security")

yml:

security.user.name=admin

security.user.password=123456

management.security.enabled=true

management.security.role=ADMIN

3.以上方式如果未能生效

在启动类加上  

@EnableResourceServer 注解

 

 

你可能感兴趣的:(java)