欢迎您访问程序员文章站本站旨在为大家提供分享程序员计算机编程知识!
您现在的位置是: 首页

There was an unexpected error (type=Unauthorized, status=401)

程序员文章站 2022-03-03 17:17:48
...

后端捕获org.springframework.security.access.AccessDeniedException: Access is denied异常。

在Application主入口配置

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


添加maven包

<dependency>
   <groupId>org.springframework.boot</groupId>
   <artifactId>spring-boot-starter-actuator</artifactId>
</dependency>

添加application-dev.properties配置文件(具体配置参考https://www.jianshu.com/p/b0b40038bb93)

security.basic.enabled=false
management.security.enabled=false