Open yangzhiw opened 6 years ago
一样 你解决了吗
你的项目是否集成spring security,而没有放开swagger资源的权限?
如果是可以参考这篇帖子:https://stackoverflow.com/a/37683455 Adding this to your WebSecurityConfiguration class should do the trick.
@Configuration
public class WebSecurityConfiguration extends WebSecurityConfigurerAdapter {
@Override
public void configure(WebSecurity web) throws Exception {
web.ignoring().antMatchers("/v2/api-docs", "/configuration/ui", "/swagger-resources", "/configuration/security", "/swagger-ui.html", "/webjars/**");
}
}
是的 是security的权限问题
我出现这个问题是因为忘记加注解 @EnableSwagger2Doc