Full authentication is required to access this resource Unauthorized

缘由:swagger测试报错

Full authentication is required to access this resource Unauthorized

解决方法:spring

在yml文件中配置安全

    security:
      basic:
        enabled: falseapp

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

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.ide

这是由于在SpringBoot2.0版本后安全配置将再也不是可定制的,解决办法:测试

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

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