diff --git a/README.md b/README.md index 72f3591..0c2c430 100644 --- a/README.md +++ b/README.md @@ -20,7 +20,7 @@ **后台模块:**[http://119.91.222.184/admin/login](http://119.91.222.184/admin/login)(账号-密码:guest@qq.com-123456) -**API 文档:** [http://119.91.222.184/swagger-ui.html](http://119.91.222.184/swagger-ui.html) +**API 文档:** [http://119.91.222.184/doc.html](http://119.91.222.184/doc.html)
diff --git a/pom.xml b/pom.xml index eb6aed5..26ec1b5 100644 --- a/pom.xml +++ b/pom.xml @@ -160,14 +160,9 @@ - io.springfox - springfox-swagger2 - 2.5.0 - - - io.springfox - springfox-swagger-ui - 2.5.0 + com.github.xiaoymin + knife4j-spring-boot-starter + 3.0.3 diff --git a/src/main/java/com/example/jieyue/common/config/Swagger2Config.java b/src/main/java/com/example/jieyue/common/config/Swagger2Config.java index 602f9fb..3ebf004 100644 --- a/src/main/java/com/example/jieyue/common/config/Swagger2Config.java +++ b/src/main/java/com/example/jieyue/common/config/Swagger2Config.java @@ -5,7 +5,6 @@ import org.springframework.context.annotation.Configuration; import springfox.documentation.builders.ApiInfoBuilder; import springfox.documentation.builders.PathSelectors; import springfox.documentation.builders.RequestHandlerSelectors; -import springfox.documentation.service.ApiInfo; import springfox.documentation.service.Contact; import springfox.documentation.spi.DocumentationType; import springfox.documentation.spring.web.plugins.Docket; @@ -14,21 +13,22 @@ import springfox.documentation.swagger2.annotations.EnableSwagger2; @EnableSwagger2 @Configuration public class Swagger2Config { - @Bean - public Docket mapRestApi() { - return new Docket(DocumentationType.SWAGGER_2).groupName("捷阅网API文档") - .apiInfo(apiInfo()).select() + @Bean(value = "defaultApi2") + public Docket defaultApi2() { + String groupName="2.0.5"; + Docket docket=new Docket(DocumentationType.OAS_30) + .apiInfo(new ApiInfoBuilder() + .title("捷阅网 API 文档") + .contact(new Contact("Bosen","https://bosen-once.gitee.io","13416263336@163.com")) + .version("2.0.5") + .build()) + //分组名称 + .groupName(groupName) + .select() + //这里指定Controller扫描包路径 .apis(RequestHandlerSelectors.basePackage("com.example.jieyue")) .paths(PathSelectors.any()) .build(); - } - - private ApiInfo apiInfo() { - return new ApiInfoBuilder() - .title("捷阅网API文档") - .description(" ") - .contact(new Contact("Bosen",null ,"13416263336.com")) - .version("2.0.5") - .build(); + return docket; } }