我有一个正在进行中的项目,它使用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();
}
}
提示:我也尝试过使用https://github.com/kongchen/swagger-maven-plugin插件,但它无法工作。