Full authentication is required to access this resource Unauthorized

原因:swagger测试报错

Full authentication is required to access this resource Unauthorized

解决方法:

在yml文件中配置

    security:
      basic:
        enabled: false

idea会报错:Deprecated: The security auto-configuration is no longer customizable less... (Ctrl+F1)

Checks Spring Boot application .yaml configuration files. Highlights unresolved and deprecated configuration keys and invalid values. Works only for Spring Boot 1.2 or higher.

这是因为在SpringBoot2.0版本后安全配置将不再是可定制的,解决办法:

在启动类上或者任意@Configure配置类上,移除默认自动启动的安全策略

@EnableAutoConfiguration(exclude = {
        org.springframework.boot.autoconfigure.security.servlet.SecurityAutoConfiguration.class
})

你可能感兴趣的:(Full authentication is required to access this resource Unauthorized)