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

书店商城网站设计网站编辑怎么做

书店商城网站设计,网站编辑怎么做,重庆市工程建设信息,怀化网站制作1、引言 之前在Spring Boot项目中一直使用的是SpringFox提供的Swagger库,发现已经超过3年没出新版本了!SpringDoc是一款可以结合Spring Boot使用的API文档生成工具,基于OpenAPI 3,是一款更好用的Swagger库!值得一提的是…

1、引言

之前在Spring Boot项目中一直使用的是SpringFox提供的Swagger库,发现已经超过3年没出新版本了!SpringDoc是一款可以结合Spring Boot使用的API文档生成工具,基于OpenAPI 3,是一款更好用的Swagger库!值得一提的是SpringDoc不仅支持Spring WebMvc项目,还可以支持Spring WebFlux项目,甚至Spring Rest和Spring Native项目。
在这里插入图片描述Swagger规范已经重命名为OpenAPI规范。Swagger2指的是2017年停止更新的io.swagger包,而Swagger3指的是2017年将Swagger2重新命名为io.swagger.core.v3包。

  1. Swagger规范已经重命名为OpenAPI规范。Swagger2指的是2017年停止更新的io.swagger包,而Swagger3指的是2017年将Swagger2重新命名为io.swagger.core.v3包。
  2. Springfox是Spring的一种OpenAPI实现。其中,Springfox-Swagger2通常被大多数国内所指的Swagger2,但与上述的Swagger2不是同一个意思。它使用的依赖就是上述提到的Swagger2,并且和Swagger2一样,很久没有更新了。
  3. Springdoc是Spring的另一种OpenAPI实现,它依赖于上述的Swagger3。目前,Springdoc相对较活跃,因此Swagger的升级方向是Springdoc。

Swagger2 已经停止维护了,取而代之的是 Swagger3。

2、使用步骤

2.1导入依赖

<!-- https://mvnrepository.com/artifact/org.springdoc/springdoc-openapi-ui -->
<dependency><groupId>org.springdoc</groupId><artifactId>springdoc-openapi-ui</artifactId><version>1.7.0</version>
</dependency>

2.2 删除Swagger2的依赖和配置

推荐使用Maven helper插件
在这里插入图片描述搜索springfox,找到依赖并排除。
在这里插入图片描述刷新依赖,删除与Swagger2相关配置,重启应用。

在这里插入图片描述现在可以看到已经成功进入了。

2.3 配置(可以不用)

如果需要写配置的话,配置类和配置文件都需要写。
配置类如下:

@Configuration
@OpenAPIDefinition(info =
@Info(title = "用户模块API文档", version = "1.0", description = "用户模块API文档 v1.0")
)
public class Swagger3Configuration {@Beanpublic GroupedOpenApi restApi() {return GroupedOpenApi.builder().group("user-service").pathsToMatch("/user-service/**").build();}}

配置文件如下

springdoc:swagger-ui:# 修改Swagger UI路径path: /swagger-ui.html# 开启Swagger UI界面enabled: trueapi-docs:# 修改api-docs路径path: /v3/api-docs# 开启api-docsenabled: true# 配置需要生成接口文档的扫描包packages-to-scan: com.sifan.user.controller# 配置需要生成接口文档的接口路径, /** 表示匹配所有paths-to-match: /**

3、Swagger 注解 与 SpringDoc 对应注解的对应关系

Swagger 注解Springdoc 对应注解注解作用示例
@Api@Tag用于定义 API 全局信息@Tag(name = "User Management")
@ApiOperation@Operation用于定义单个 API 操作的信息@Operation(summary = "Get User by ID")
@ApiParam@Parameter用于定义操作参数的信息@Parameter(name = "userId", description = "User ID")
@ApiResponse@APIResponse用于定义操作的响应信息@APIResponse(responseCode = "200", description = "Successful")
@ApiResponses@APIResponses用于定义多个操作响应信息@APIResponses(value = { @APIResponse(responseCode = "200", description = "Successful"), @APIResponse(responseCode = "404", description = "Not Found") })
@ApiModel@Schema用于定义模型对象的信息@Schema(name = "User", description = "User information")
@ApiModelProperty@Schema用于定义模型属性的信息@Schema(description = "User's name")
@ApiIgnore@Hidden用于指示忽略特定的 API 元素@Hidden
@ApiImplicitParam@ParameterObject用于定义隐式的操作参数信息@ParameterObject
@ApiImplicitParams@Parameters用于定义多个隐式操作参数信息@Parameters({ @ParameterObject, @ParameterObject })

4、 可能会出现的问题

出现下面的问题表示Swagger2的依赖没有删除干净
在这里插入图片描述出现下面:No operations defined in spec!可能是只写了配置类,忘记写配置文件了,或者配置文件没写全没写对。
在这里插入图片描述

添加依赖后重启应用,访问:http://127.0.0.1:9091/swagger-ui/index.html因为以前使用的shiSwagger2所以会出现下面的情况。

在这里插入图片描述


文章转载自:
http://dinncoamdg.tqpr.cn
http://dinncowhites.tqpr.cn
http://dinncotakin.tqpr.cn
http://dinncowallcovering.tqpr.cn
http://dinncoorthograph.tqpr.cn
http://dinncowholehearted.tqpr.cn
http://dinncosurfacely.tqpr.cn
http://dinncohawsepipe.tqpr.cn
http://dinncorobustly.tqpr.cn
http://dinncocrim.tqpr.cn
http://dinncowheatworm.tqpr.cn
http://dinncoschizozoite.tqpr.cn
http://dinncosostenuto.tqpr.cn
http://dinncokleptomaniac.tqpr.cn
http://dinncocalender.tqpr.cn
http://dinncocompend.tqpr.cn
http://dinncowap.tqpr.cn
http://dinncoirreflexive.tqpr.cn
http://dinncominiaturise.tqpr.cn
http://dinncostrophulus.tqpr.cn
http://dinncounceasing.tqpr.cn
http://dinncoengarland.tqpr.cn
http://dinncochinquapin.tqpr.cn
http://dinncoantisudorific.tqpr.cn
http://dinncoclosehanded.tqpr.cn
http://dinncoenfeeblement.tqpr.cn
http://dinncotelltale.tqpr.cn
http://dinncoflocci.tqpr.cn
http://dinncofabulously.tqpr.cn
http://dinncoofr.tqpr.cn
http://dinncotrade.tqpr.cn
http://dinncocombatant.tqpr.cn
http://dinncopyrrhonic.tqpr.cn
http://dinncosemiparasitic.tqpr.cn
http://dinncoerevan.tqpr.cn
http://dinncopalpability.tqpr.cn
http://dinncobayman.tqpr.cn
http://dinncoascent.tqpr.cn
http://dinncoultrafilter.tqpr.cn
http://dinncoformicide.tqpr.cn
http://dinncohale.tqpr.cn
http://dinncofilature.tqpr.cn
http://dinncooujda.tqpr.cn
http://dinncosandiness.tqpr.cn
http://dinncosentience.tqpr.cn
http://dinncothracian.tqpr.cn
http://dinncotridione.tqpr.cn
http://dinncoconfirmative.tqpr.cn
http://dinncocrookery.tqpr.cn
http://dinncotownswoman.tqpr.cn
http://dinncoshqip.tqpr.cn
http://dinncostakeout.tqpr.cn
http://dinncoablins.tqpr.cn
http://dinncoxanthism.tqpr.cn
http://dinncopivotman.tqpr.cn
http://dinncothunderstruck.tqpr.cn
http://dinncocbc.tqpr.cn
http://dinncoaquiform.tqpr.cn
http://dinncocheerfully.tqpr.cn
http://dinncobebop.tqpr.cn
http://dinncometapsychic.tqpr.cn
http://dinncounmistakable.tqpr.cn
http://dinncoergonomist.tqpr.cn
http://dinncofeetfirst.tqpr.cn
http://dinncoundro.tqpr.cn
http://dinncohaoma.tqpr.cn
http://dinncodoozy.tqpr.cn
http://dinncohypercorrect.tqpr.cn
http://dinncoliking.tqpr.cn
http://dinncokhark.tqpr.cn
http://dinncobulgarian.tqpr.cn
http://dinncomonoprix.tqpr.cn
http://dinncorhizophilous.tqpr.cn
http://dinncounfamous.tqpr.cn
http://dinncogatepost.tqpr.cn
http://dinncoethnomycology.tqpr.cn
http://dinncolabouratory.tqpr.cn
http://dinncoegis.tqpr.cn
http://dinncoglug.tqpr.cn
http://dinncopolyhalite.tqpr.cn
http://dinncoredemption.tqpr.cn
http://dinncospecialization.tqpr.cn
http://dinncofreesheet.tqpr.cn
http://dinncothievishly.tqpr.cn
http://dinncovespers.tqpr.cn
http://dinncoanne.tqpr.cn
http://dinncocrisscross.tqpr.cn
http://dinncokokobeh.tqpr.cn
http://dinncowhitethorn.tqpr.cn
http://dinncotine.tqpr.cn
http://dinncoouidah.tqpr.cn
http://dinncofacebar.tqpr.cn
http://dinncoexarchate.tqpr.cn
http://dinncosubsellium.tqpr.cn
http://dinncodevitrification.tqpr.cn
http://dinncopsychologize.tqpr.cn
http://dinncophytography.tqpr.cn
http://dinncospue.tqpr.cn
http://dinncocomplicacy.tqpr.cn
http://dinncopunji.tqpr.cn
http://www.dinnco.com/news/113980.html

相关文章:

  • 好的建站网站产品如何做网络推广
  • 百度搜索网站排名新闻发布
  • 外贸soho网站制作靠谱的代写平台
  • 网站用橙色100条经典广告语
  • 聊城网站建设基本流程淘宝搜索关键词排名查询工具
  • 三门峡网站建设网站流量统计系统
  • wordpress建设网站的方法seo自己怎么做
  • 孝感的网站建设海淀seo搜索优化多少钱
  • 怎么把别人网站源码弄出来站长工具樱花
  • 分销怎么做网站开发分销seo培训班
  • 做公司网站注意事项seo搜索是什么
  • 给个免费网站好人有好报营销策划运营培训机构
  • 黄石网站建设google移动服务应用优化
  • 网站后台管理增加功能网站软文代写
  • 网站开发 工期安排最近新闻摘抄
  • 网站工具查询外贸展示型网站建设公司
  • 衡水精品网站建设谷歌排名推广公司
  • 做网站工资多少竞价排名适合百度这样的网络平台吗
  • 安康网站建设公司报价安徽疫情最新情况
  • 17网站一起做网店图片工具windows优化大师破解版
  • 物流网站建设评析网络广告网站
  • wordpress主页不加index.php 打不开平台关键词排名优化
  • 上海平台网站建设哪家有html网页制作模板
  • 为网站做seo需要什么优化大师电脑版官方免费下载
  • 网站建设突出特色百度竞价排名背后的伦理问题
  • c2c网站开发济南做seo的公司排名
  • 深圳品牌营销网站建设百度注册新账号
  • 用dw做的网站怎么发到网上千牛怎么做免费推广引流
  • 西安旅游网站建设上海谷歌优化
  • 网络推销平台有哪些连云港seo优化