我配置了swagger2與彈簧啓動。 適用於小型項目。但在很多休息的大項目中會導致stackOverflowError。stackoverflow在彈簧啓動時運行swagger2時出錯
招搖配置:
@Configuration
@EnableSwagger2
public class SwaggerConfiguration {
@Bean
public Docket api(){
return new Docket(DocumentationType.SWAGGER_2)
.select()
.apis(RequestHandlerSelectors.basePackage("org.dordas.swagger.web.controller"))
.paths(PathSelectors.ant("/api/**"))
.build();
}
}
錯誤:
org.springframework.context.ApplicationContextException: Failed to start bean 'documentationPluginsBootstrapper';
nested exception is com.google.common.util.concurrent.ExecutionError: java.lang.StackOverflowError
at org.springframework.context.support.DefaultLifecycleProcessor.doStart(DefaultLifecycleProcessor.java:176)