在基于Springfox的项目的编译时生成庞大的JSON文件

May*_*yur 3 java spring spring-mvc spring-boot springfox

我有一个正在使用Springfox生成API文档的项目。

我想在编译时生成swagger.json 。

以下是示例springfox配置,

@Configuration
@EnableSwagger2
public class SwaggerConfig {
    @Bean
    public Docket productApi() {
        return new Docket(DocumentationType.SWAGGER_2)
                .select()                 
                .apis(RequestHandlerSelectors.basePackage("com.abc.xyz"))
                .paths(regex("/*.*"))
                .build();
    }
}
Run Code Online (Sandbox Code Playgroud)

仅供参考:我也尝试过https://github.com/kongchen/swagger-maven-plugin插件,但是它不起作用

May*_*yur 7

这是使用JUnit测试用例实现的,有关更多详细信息,请关注https://github.com/springfox/springfox/issues/1959