Spring Boot整合Security+Swagger2踩坑记录,Swagger2无法访问首页(亲自测试)
有可能出现的原因:
1.Security将访问拦截掉了
2.给拦截器拦截了
3.Swagger返回的结果,被自己定义的拦截器or其他方式给篡改了数据,导致无法正常显示,也就无法得到想要的结果
//忽略swagger访问权限限制 .antMatchers( "/userlogin", "/userlogout", "/userjwt", "/v2/api-docs", "/swagger-resources/configuration/ui", "/swagger-resources", "/swagger-resources/configuration/security", "/swagger-ui.html", "/css/**", "/js/**", "/images/**", "/webjars/**", "/import/test", "**/favicon.ico", "/index").permitAll()
其中
"/v2/api-docs",
"/swagger-resources/configuration/ui",
"/swagger-resources",
"/swagger-resources/configuration/security",
"/swagger-ui.html",
这几项必须都加上才生效。
posted on 2021-10-21 10:41 boboxing2017 阅读(1786) 评论(2) 编辑 收藏 举报