-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
13 changed files
with
68 additions
and
153 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
45 changes: 13 additions & 32 deletions
45
kbase-stack-base/src/main/java/com/ibothub/heap/base/config/SwaggerConfig.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,50 +1,31 @@ | ||
|
||
package com.ibothub.heap.base.config; | ||
|
||
import io.swagger.annotations.Api; | ||
import org.apache.tomcat.util.net.openssl.ciphers.Authentication; | ||
import io.swagger.v3.oas.annotations.OpenAPIDefinition; | ||
import io.swagger.v3.oas.models.OpenAPI; | ||
import io.swagger.v3.oas.models.info.Contact; | ||
import io.swagger.v3.oas.models.info.Info; | ||
import org.springframework.context.annotation.Bean; | ||
import org.springframework.context.annotation.Configuration; | ||
import org.springframework.http.MediaType; | ||
import springfox.documentation.builders.ApiInfoBuilder; | ||
import springfox.documentation.builders.PathSelectors; | ||
import springfox.documentation.builders.RequestHandlerSelectors; | ||
import springfox.documentation.service.ApiInfo; | ||
import springfox.documentation.spi.DocumentationType; | ||
import springfox.documentation.spring.web.plugins.Docket; | ||
import java.util.Collections; | ||
import springfox.documentation.swagger2.annotations.EnableSwagger2WebMvc; | ||
|
||
/** | ||
* @author <a href="mailto:[email protected]">eko.zhan</a> | ||
* @version v1.0 | ||
* @date 2020/10/15 20:25 | ||
*/ | ||
@Configuration | ||
@EnableSwagger2WebMvc | ||
@OpenAPIDefinition | ||
public class SwaggerConfig { | ||
|
||
@Bean | ||
public Docket createRestApi() { | ||
return new Docket(DocumentationType.SWAGGER_2) | ||
.produces(Collections.singleton(MediaType.APPLICATION_JSON_UTF8_VALUE)) | ||
.consumes(Collections.singleton(MediaType.APPLICATION_JSON_UTF8_VALUE)) | ||
.ignoredParameterTypes(Authentication.class) | ||
.useDefaultResponseMessages(false) | ||
.apiInfo(apiInfo()) | ||
.select() | ||
.apis(RequestHandlerSelectors.withClassAnnotation(Api.class)) | ||
.paths(PathSelectors.any()) | ||
.build(); | ||
} | ||
|
||
|
||
private ApiInfo apiInfo() { | ||
return new ApiInfoBuilder() | ||
.title("接口文档") | ||
.termsOfServiceUrl("http://ibothub.com/") | ||
.version("1.0") | ||
.build(); | ||
public OpenAPI openAPI() { | ||
return new OpenAPI() | ||
.info(new Info() | ||
.title("swagger api") | ||
.contact(new Contact().name("eko.zhan").url("https://ekozhan.com")) | ||
.description("swagger api") | ||
.version("2.0.0") | ||
); | ||
} | ||
|
||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.