項目中引入了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/**" ); }