swagger使用
[*]1. 官网
[*]2. API发布路径
[*]3. 自定义包路径,配置其扫描路径
[*]4. 配置扫描多个包
1. 官网https://swagger.io/组件
[*]Swagger-tools
[*]Swagger-core java
[*]Swagger-js js
[*]Swagger-node-express:
[*]Swagger-ui
[*]Swagger-codegen
2. API发布路径http://localhost:8080/jeecg-boot/swagger-ui.html3. 自定义包路径,配置其扫描路径org.jeecg.config.Swagger2Config.apis(RequestHandlerSelectors.basePackage("com.xxx.core"))4. 配置扫描多个包import com.google.common.base.Function;import com.google.common.base.Optional;import com.google.common.base.Predicate; import springfox.documentation.RequestHandler; .apis(basePackage("org.jeecg.modules"+";"+"com.xxx.core")) public static Predicate<RequestHandler> basePackage(finalString basePackage) { returninput -> declaringClass(input).transform(handlerPackage(basePackage)).or(true);}private static Function<Class<?>, Boolean> handlerPackage(finalString basePackage) { return input ->{ // 循环判断匹配 for (StringstrPackage : basePackage.split(splitor)) { booleanisMatch = input.getPackage().getName().startsWith(strPackage); if (isMatch){ returntrue; } } return false; };}private static Optional<? extends Class<?>> declaringClass(RequestHandlerinput) { return Optional.fromNullable(input.declaringClass());}
页:
[1]