package com.zsc.config;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import org.springframework.http.ResponseEntity;
import org.springframework.util.StopWatch;
import springfox.documentation.service.ApiInfo;
import springfox.documentation.spi.DocumentationType;
import springfox.documentation.spring.web.plugins.Docket;
import springfox.documentation.swagger2.annotations.EnableSwagger2;
import javax.xml.crypto.Data;
import static springfox.documentation.builders.PathSelectors.regex;
/**
*
* @author lenovo
*/
@Configuration
@EnableSwagger2
public class SwaggerConfiguration {
/**
* 定义API接口映射路径
*/
public static final String DEFAULT_INCLUDE_PATTERN = "/order/.*";
private final Logger logger = LoggerFactory.getLogger(SwaggerConfiguration.class);
@Bean
public Docket swaggerSpringfoxDocket() {
logger.debug("Starting Swagger~");
StopWatch stopWatch = new StopWatch();
stopWatch.start();
/**
* String title, String description,
* String version, String termsOfServiceUrl,
* String contact, String license,
* String licenseUrl
*/
ApiInfo apiInfo = new ApiInfo("订单管理API接口测试文档", "商品接口API文档",
"0.0.1", "termsOfServiceUrl",
"contact", "", "");
Docket docket = new Docket(DocumentationType.SWAGGER_2)
.apiInfo(apiInfo)
.genericModelSubstitutes(ResponseEntity.class)
.forCodeGeneration(true)
// .genericModelSubstitutes(ResponseEntity.class)
.directModelSubstitute(java.time.LocalDate.class, String.class)
.directModelSubstitute(java.time.ZonedDateTime.class, Data.class)
.directModelSubstitute(java.time.LocalDate.class, Data.class)
.select()
// 匹配路径生成对应接口文档
.paths(regex(DEFAULT_INCLUDE_PATTERN))
.build();
stopWatch.stop();
logger.debug("Started Swagger in {} ms,ok",stopWatch.getTotalTimeMillis());
return docket;
}
}
没有合适的资源?快使用搜索试试~ 我知道了~
资源推荐
资源详情
资源评论
收起资源包目录
springboot_integrate.zip (77个子文件)
shiyannsix.sql 0B
pom.xml 2KB
user-service
pom.xml 2KB
src
test
java
main
resources
dist
swagger-ui-standalone-preset.js.map 168B
swagger-ui.js.map 121B
swagger-ui-bundle.js.map 264B
swagger-ui.css 30KB
favicon-32x32.png 1KB
oauth2-redirect.html 2KB
swagger-ui.js 286KB
swagger-ui-bundle.js 1.26MB
swagger-ui-standalone-preset.js 254KB
index.html 4KB
swagger-ui.css.map 80B
favicon-16x16.png 445B
application.yaml 812B
java
com
zsc
mapper
UserMapper.java 394B
controller
UserController.java 1KB
pojo
Order.java 233B
User.java 530B
config
BeanConfig.java 369B
SwaggerConfiguration.java 2KB
UserApplication.java 436B
target
classes
application.yaml 812B
com
zsc
mapper
UserMapper.class 418B
controller
UserController.class 2KB
UserApplication.class 783B
pojo
User.class 3KB
Order.class 2KB
config
SwaggerConfiguration.class 3KB
BeanConfig.class 625B
generated-sources
annotations
src
test
java
main
resources
java
shiyansix_2.sql 6KB
.idea
jarRepositories.xml 879B
uiDesigner.xml 9KB
qaplug_profiles.xml 41KB
workspace.xml 7KB
misc.xml 887B
inspectionProfiles
Project_Default.xml 1KB
compiler.xml 1KB
.gitignore 0B
encodings.xml 605B
$PROJECT_FILE$ 364B
order-service
pom.xml 2KB
src
test
java
main
resources
dist
swagger-ui-standalone-preset.js.map 168B
swagger-ui.js.map 121B
swagger-ui-bundle.js.map 264B
swagger-ui.css 30KB
favicon-32x32.png 1KB
oauth2-redirect.html 2KB
swagger-ui.js 286KB
swagger-ui-bundle.js 1.26MB
swagger-ui-standalone-preset.js 254KB
index.html 4KB
swagger-ui.css.map 80B
favicon-16x16.png 445B
application.yaml 928B
java
com
zsc
mapper
OrderMapper.java 416B
OrderApplication.java 438B
controller
OrderController.java 1KB
pojo
Order.java 233B
config
SwaggerConfiguration.java 2KB
target
classes
application.yaml 928B
com
zsc
OrderApplication.class 786B
mapper
OrderMapper.class 411B
controller
OrderController.class 1KB
pojo
Order.class 2KB
config
SwaggerConfiguration.class 3KB
generated-sources
annotations
eureka-server
pom.xml 920B
src
test
java
main
resources
application.yaml 383B
java
com
zsc
EurekaServerApplication.java 459B
target
classes
application.yaml 383B
com
zsc
EurekaServerApplication.class 814B
generated-sources
annotations
gateway-zuul
pom.xml 1KB
src
test
java
main
resources
application.yaml 360B
java
com
zsc
ZuulApplication.java 428B
target
classes
application.yaml 360B
com
zsc
ZuulApplication.class 778B
generated-sources
annotations
共 77 条
- 1
资源评论
拾贰_C
- 粉丝: 2052
- 资源: 41
上传资源 快速赚钱
- 我的内容管理 展开
- 我的资源 快来上传第一个资源
- 我的收益 登录查看自己的收益
- 我的积分 登录查看自己的积分
- 我的C币 登录后查看C币余额
- 我的收藏
- 我的下载
- 下载帮助
最新资源
- Windows 串口通信工具putty
- 常用基础元件的PCB封装库SchLib/IntLib通用原理图库LED发光二极管
- java+mysql实现mvc.zip
- C#在线考试系统源码数据库 Access源码类型 WebForm
- 常用基础元件的PCB封装库SchLib/IntLib通用原理图库FLASH存储器
- Screenshot_20241117_061647_com.tencent.tmgp.sgame.jpg
- NI-VISA资源安装包
- 常用基础元件的PCB封装库SchLib/IntLib集成库常见基础元器件
- c++控制台RPG小游戏
- C#BS酒店管理系统源码数据库 SQL2008源码类型 WebForm
资源上传下载、课程学习等过程中有任何疑问或建议,欢迎提出宝贵意见哦~我们会及时处理!
点击此处反馈
安全验证
文档复制为VIP权益,开通VIP直接复制
信息提交成功