您当前的位置: 首页 >  spring

springboot项目整合Swagger2

发布时间:2021-01-11 10:45:00 ,浏览量:0

项目整合 swagger

在聚合工程中的父 pom 工程的 pom 文件中添加依赖

 <dependency> <groupId>io.springfox public static final DocumentationType SWAGGER_12 = new DocumentationType("swagger", "1.2"); public static final DocumentationType SWAGGER_2 = new DocumentationType("swagger", "2.0"); public static final DocumentationType SPRING_WEB = new DocumentationType("spring-web", "1.0"); private final MediaType mediaType; /**
   * Creates a new instance of {@code SimplePluginMetadata}.
   */ public DocumentationType(String name, String version, MediaType mediaType) { super(name, version); this.mediaType = mediaType; } public DocumentationType(String name, String version) { this(name, version, MediaType.APPLICATION_JSON); } public MediaType getMediaType() { return mediaType; } @Override public boolean equals(Object o) { if (this == o) { return true; } if (!(o instanceof DocumentationType)) { return false; } if (!super.equals(o)) { return false; } DocumentationType that = (DocumentationType) o; return super.equals(that) && mediaType.equals(that.mediaType); } @Override public int hashCode() { int result = super.hashCode(); result = 31 * result + mediaType.hashCode(); return result; } } 
Swagger JSON Doc
  • 在线编辑地址 https://editor.swagger.io/
  • 编辑生成样板代码 所以 swagger 不仅支持代码优先还支持契约优先编程。
关注
打赏
1688896170
查看更多评论

暂无认证

  • 0浏览

    0关注

    115984博文

    0收益

  • 0浏览

    0点赞

    0打赏

    0留言

私信
关注
热门博文
立即登录/注册

微信扫码登录

0.0544s