1. phenomenon
It is a visit to pop up a box you have been redirected to collapse, must take the page to turn off the job. . .
2. Possible problem
(1) You start classes which did not add @ EnableSwagger2Doc notes;
(2) you yml there is no open switch:
swagger:
enabled: true
(3) you use interceptors (for example: login authentication interceptors) (for example: an inherited something of WebMvcConfigurationSupport), it did not exclude the path out of resources:
[Plan] Key: most likely you exclude the wrong path. For example, the deployment of the war package, often visit more than a project name than localhost. Be sure to check ah! ! !
@Override public void addResourceHandlers(final ResourceHandlerRegistry registry) { registry.addResourceHandler("/assets/**").addResourceLocations("/resources/assets/"); //swagger增加url映射 registry.addResourceHandler("swagger-ui.html") .addResourceLocations("classpath:/META-INF/resources/"); registry.addResourceHandler("/webjars/**") .addResourceLocations("classpath:/META-INF/resources/webjars/"); public @Override // Here configured interceptor intercepting the path and the path does not intercept } void addInterceptors(InterceptorRegistry registry) { registry.addInterceptor(this.logInterceptor).addPathPatterns("/**"); registry.addInterceptor(this.authenticationInterceptor).addPathPatterns("/**").excludePathPatterns("/swagger-ui.html", "/webjars/**", "/**/swagger-resources/**"); }
(4) does not work, try this:
@EnableSwagger2Doc @SpringBootApplication public class ServerApplication extends SpringBootServletInitializer { public static void main(String[] args) { SpringApplication.run(ServerApplication.class, args); } @Override protected SpringApplicationBuilder configure(SpringApplicationBuilder application) { return application.sources(ServerApplication.class); } }
(5) No way. Ask big brother big brother to help you make the source code to see how to configure it. (Nugget)