美化API文档
parent
aebfed62b6
commit
3ae519f7b6
|
@ -20,7 +20,7 @@
|
||||||
|
|
||||||
**后台模块:**[http://119.91.222.184/admin/login](http://119.91.222.184/admin/login)(账号-密码:guest@qq.com-123456)
|
**后台模块:**[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)
|
||||||
|
|
||||||
<br/>
|
<br/>
|
||||||
|
|
||||||
|
|
11
pom.xml
11
pom.xml
|
@ -160,14 +160,9 @@
|
||||||
</dependency>
|
</dependency>
|
||||||
<!-- swagger api文档生成工具 -->
|
<!-- swagger api文档生成工具 -->
|
||||||
<dependency>
|
<dependency>
|
||||||
<groupId>io.springfox</groupId>
|
<groupId>com.github.xiaoymin</groupId>
|
||||||
<artifactId>springfox-swagger2</artifactId>
|
<artifactId>knife4j-spring-boot-starter</artifactId>
|
||||||
<version>2.5.0</version>
|
<version>3.0.3</version>
|
||||||
</dependency>
|
|
||||||
<dependency>
|
|
||||||
<groupId>io.springfox</groupId>
|
|
||||||
<artifactId>springfox-swagger-ui</artifactId>
|
|
||||||
<version>2.5.0</version>
|
|
||||||
</dependency>
|
</dependency>
|
||||||
</dependencies>
|
</dependencies>
|
||||||
|
|
||||||
|
|
|
@ -5,7 +5,6 @@ import org.springframework.context.annotation.Configuration;
|
||||||
import springfox.documentation.builders.ApiInfoBuilder;
|
import springfox.documentation.builders.ApiInfoBuilder;
|
||||||
import springfox.documentation.builders.PathSelectors;
|
import springfox.documentation.builders.PathSelectors;
|
||||||
import springfox.documentation.builders.RequestHandlerSelectors;
|
import springfox.documentation.builders.RequestHandlerSelectors;
|
||||||
import springfox.documentation.service.ApiInfo;
|
|
||||||
import springfox.documentation.service.Contact;
|
import springfox.documentation.service.Contact;
|
||||||
import springfox.documentation.spi.DocumentationType;
|
import springfox.documentation.spi.DocumentationType;
|
||||||
import springfox.documentation.spring.web.plugins.Docket;
|
import springfox.documentation.spring.web.plugins.Docket;
|
||||||
|
@ -14,21 +13,22 @@ import springfox.documentation.swagger2.annotations.EnableSwagger2;
|
||||||
@EnableSwagger2
|
@EnableSwagger2
|
||||||
@Configuration
|
@Configuration
|
||||||
public class Swagger2Config {
|
public class Swagger2Config {
|
||||||
@Bean
|
@Bean(value = "defaultApi2")
|
||||||
public Docket mapRestApi() {
|
public Docket defaultApi2() {
|
||||||
return new Docket(DocumentationType.SWAGGER_2).groupName("捷阅网API文档")
|
String groupName="2.0.5";
|
||||||
.apiInfo(apiInfo()).select()
|
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"))
|
.apis(RequestHandlerSelectors.basePackage("com.example.jieyue"))
|
||||||
.paths(PathSelectors.any())
|
.paths(PathSelectors.any())
|
||||||
.build();
|
.build();
|
||||||
}
|
return docket;
|
||||||
|
|
||||||
private ApiInfo apiInfo() {
|
|
||||||
return new ApiInfoBuilder()
|
|
||||||
.title("捷阅网API文档")
|
|
||||||
.description(" ")
|
|
||||||
.contact(new Contact("Bosen",null ,"13416263336.com"))
|
|
||||||
.version("2.0.5")
|
|
||||||
.build();
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue