2017-02-01 98 views
1

我配置了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) 

回答

0

在控制器中的一些實體PARAMS指每一個到另一個,這導致招搖無限遞歸(例如在組類型屬性實體當你使用休眠)。

=>使用@ApiIgnore忽略實體參數,可以並用@ApiImplicitParams來形容您的PARAMS

0

也許你有註釋語法, 例如@ApiParam(allowableValues =「範圍[0-3276843] 「),」範圍「是錯誤的。

相關問題