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

1. 关闭验证

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

2.开启HTTP basic认证 

maven:

 <dependency>

<groupId>org.springframework.boot</groupId>

<artifactId>spring-boot-starter-security</artifactId>

</dependency>

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 注解

 

 


版权声明:本文为ace_1949原创文章,遵循CC 4.0 BY-SA版权协议,转载请附上原文出处链接和本声明。