我想在以下位置生成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 更多细节。