SpringForAll / spring-boot-starter-swagger

自制spring boot starter for swagger 2.x,来试试吧,很好用哦~
Apache License 2.0
2.13k stars 523 forks source link

Unable to infer base url #48

Open yangzhiw opened 6 years ago

yangzhiw commented 6 years ago

image

Przeblysk commented 6 years ago

一样 你解决了吗

jonashao commented 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/**");
    }

}
Przeblysk commented 6 years ago

是的 是security的权限问题

DimonHo commented 6 years ago

我出现这个问题是因为忘记加注解 @EnableSwagger2Doc