spring-boot-starter-swagger icon indicating copy to clipboard operation
spring-boot-starter-swagger copied to clipboard

Unable to infer base url

Open yangzhiw opened this issue 7 years ago • 4 comments

image

yangzhiw avatar Jan 08 '18 06:01 yangzhiw

一样 你解决了吗

Przeblysk avatar Feb 10 '18 02:02 Przeblysk

你的项目是否集成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/**");
    }

}

jonashao avatar Apr 28 '18 03:04 jonashao

是的 是security的权限问题

Przeblysk avatar May 02 '18 01:05 Przeblysk

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

DimonHo avatar Jun 06 '18 06:06 DimonHo