gpt4 book ai didi

java - 在编译时为基于 springfox 的项目生成 swagger JSON 文件

转载 作者:塔克拉玛干 更新时间:2023-11-01 22:19:46 25 4
gpt4 key购买 nike

我有一个正在使用 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插件,但它不工作

最佳答案

这是使用 JUnit 测试用例实现的,遵循 https://github.com/springfox/springfox/issues/1959了解更多详情。

关于java - 在编译时为基于 springfox 的项目生成 swagger JSON 文件,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/53848917/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com