当前位置: 首页 > news >正文

网页游戏破解版公众号关键词排名优化

网页游戏破解版,公众号关键词排名优化,个人如何做一个网站,版面设计一、场景 环境: 二、存在问题 三、解决方案 四、实战 - Swagger 2 升至 3.0 (Open API 3.0) Stage 1:引入Maven依赖 Stage 2:Swagger 配置类 Stage 3:访问 Swagger 3.0 Stage 4:获取 js…

一、场景

环境:

二、存在问题

三、解决方案

四、实战 - Swagger 2 升至 3.0 (Open API 3.0)

Stage 1:引入Maven依赖

Stage 2:Swagger 配置类

Stage 3:访问 Swagger 3.0

Stage 4:获取 json,保存为 swagger.json

Stage 5:showdoc 中导入 swagger.json

Stage 6:导入效果


一、场景

  • 公司需要将 swagger-ui 中的接口导入到 showdoc 中

  • 思路 :获取 swagger.json 并导入到 showdoc 中 (http://ip:port/v2/api-docs 获取json)

 

环境:

  • Spring boot 2.5.4

  • Swagger ui2.9.2

  • JDK : 1.8

 

二、存在问题

  • http://ip:port/v2/api-docs 报错无法获取完整的JSON

 

三、解决方案

  • 方案一:升至Swagger 3,获取json,保存为xxx.json,再导入 showdoc中 (适合全量导入)

  • 方案二:集成 knife4j ,单个接口json,保存为xxx.json,再导入 showdoc中(适合部分导入 + 前端调试)

四、实战 - Swagger 2 升至 3.0 (Open API 3.0)

Stage 1:引入Maven依赖

        <!--swagger3--><dependency><groupId>io.springfox</groupId><artifactId>springfox-boot-starter</artifactId><version>3.0.0</version></dependency>
wAAACH5BAEKAAAALAAAAAABAAEAAAICRAEAOw==

Stage 2:Swagger 配置类

  • 注意: .title("XPH- iot 接口文档") 

import io.swagger.annotations.ApiOperation;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.boot.autoconfigure.condition.ConditionalOnProperty;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import org.springframework.web.servlet.config.annotation.ResourceHandlerRegistry;
import org.springframework.web.servlet.config.annotation.WebMvcConfigurationSupport;
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;// 自定义swagger3文档信息
@Configuration
@ConditionalOnProperty(value = "springfox.documentation.enabled", havingValue = "true", matchIfMissing = true)
@Slf4j
public class Swagger3Config extends WebMvcConfigurationSupport {@Value(value = "${host:localhost}")private String host;@Value("${server.port:8005}")private String port;@Beanpublic Docket createRestApi() {return new Docket(DocumentationType.OAS_30).apiInfo(apiInfo()).select().apis(RequestHandlerSelectors.withMethodAnnotation(ApiOperation.class)).paths(PathSelectors.any()).build();}private ApiInfo apiInfo() {log.info("http://{}:{}/swagger-ui.html", host, port);log.info("http://localhost:{}/swagger-ui.html", port);log.info("http://localhost:{}/swagger-ui/index.html", port);log.info("http://localhost:{}/doc.html", port);return new ApiInfoBuilder().title("XPH- iot 接口文档").description("更多请咨询").contact(new Contact("lijiong", "https://", "xxx@")).version("1.0.0").build();}@Overridepublic void addResourceHandlers(ResourceHandlerRegistry registry) {registry.addResourceHandler("/**").addResourceLocations("classpath:/static/");//swagger 2registry.addResourceHandler("swagger-ui.html").addResourceLocations("classpath:/META-INF/resources/");//swagger 3registry.addResourceHandler("/swagger-ui/**").addResourceLocations("classpath:/META-INF/resources/webjars/springfox-swagger-ui/");registry.addResourceHandler("doc.html").addResourceLocations("classpath:/META-INF/resources/");registry.addResourceHandler("/webjars/**").addResourceLocations("classpath:/META-INF/resources/webjars/");super.addResourceHandlers(registry);}
}
wAAACH5BAEKAAAALAAAAAABAAEAAAICRAEAOw==

Stage 3:访问 Swagger 3.0

  • https://localhost:port/swagger-ui/index.html

 

Stage 4:获取 json,保存为 swagger.json

  

 

Stage 5:showdoc 中导入 swagger.json

  • 全量导入会自动生成一个项目名为:swaggerUI title的项目

 

 

Stage 6:导入效果

 

http://www.yidumall.com/news/1006.html

相关文章:

  • 国外做医疗器械b2b网站关键词免费下载
  • 网站制作知识百度关键词挖掘工具爱站网
  • 网站开发委托服务合同范本手机网站seo免费软件
  • 马达加工东莞网站建设seo网站推广培训
  • 怎么用自己的网站做邮箱网站推广 方法
  • 模板网站可以做webapp外链下载
  • 建设网站的风险6百度seo通科
  • 网站登记表免费推广网站2023mmm
  • 斐讯k3做网站百度识图在线识别
  • 惠州网站建设效果西安做推广优化的公司
  • 合肥高端网站建设公司哪家好国家高新技术企业认定
  • 美容产品网站建设多少钱深圳seo优化
  • 网站制作 需要什么网络技术企业如何进行搜索引擎优化
  • 日本做美食视频网站有哪些高端企业网站建设
  • 贵阳经开区建设管理局网站武汉楼市最新消息
  • g点网站建设工作室优化营商环境 提升服务效能
  • 个人备案 网站名百度竞价
  • 厦门做网页网站的公司泉州seo
  • 直播软件下载网站整站seo怎么做
  • 网站设计怎么做明信片网络营销的概念及内容
  • 做网站需要学php哪些技术推广营销网络
  • 免费的个人简历模板excelseo会被取代吗
  • 响应式网站 解决方案抖音优化排名
  • 海兴网站建设公司网页设计软件有哪些
  • 小程序开发外包注意事项天津seo建站
  • dw做高逼格的网站百度平台我的订单查询在哪里
  • 昆明做凡科网站制作网站软件
  • 担路网如何快速做网站友情链接有什么用
  • 做日本暖暖小视频网站一般开车用什么导航最好
  • 网站建设手机端百度点击工具