项目中引入了SpringSecurity依赖

 

可能的原因:

  1、API文档路径完全进不去 - 在SpringSecurity的配置类中没有设置放行文档的路径

  2、API文档界面不显示内容 - 在SpringSecurity的配置类中没有设置放行Swagger2需要的资源

 

附上SpringSecurity的配置类中没有设置放行的代码

 @Override
    public void configure(WebSecurity web) throws Exception {
        web.ignoring().antMatchers(
                "/login",
                "/logout",
                "/css/**",
                "/js/**",
//                首页
                "index.html",
//                图标
                "favicon.ico",
//               swagger2
//   我引入的是第三方ui,故路径与官方不同 
                "/doc.html",
// 下面swagger2需要的一些资源
                "/webjars/**",
                "/swagger-resources/**",
                "/v2/api-docs/**"
        );
    }   

 

相关文章:

  • 2021-10-05
  • 2021-12-12
  • 2021-06-17
  • 2021-04-13
  • 2022-12-23
  • 2021-07-16
猜你喜欢
  • 2022-12-23
  • 2021-12-26
  • 2021-05-08
  • 2021-11-30
  • 2022-12-23
  • 2021-05-30
  • 2021-06-24
相关资源
相似解决方案