参考文档:
https://blog.csdn.net/qq_43340419/article/details/120312937
解决方案:需要在WebSecurityConfig 中 配置允许匿名访问的路径
.antMatchers(
"/v2/api-docs",
"/swagger-resources/configuration/ui",
"/swagger-resources",
"/swagger-resources/configuration/security",
"/doc.html",
"/swagger-ui.html",
"/webjars/**").permitAll()
效果: