springboot整合swagger2遇到的坑

今天准备把springboot项目整合swagger2,来定义接口及其信息,遇到的坑,记录一下spring


springboot整合swagger2步骤
springboot

一、配置pom.xmlide

image.png


二、建立swagger配置类spa


image.png

三、这启动类中加上注解3d

@EnableSwagger2xml


具体如何整合能够百度,资料不少
blog

而后在启动项目的时候报了下面这个错误:接口

image.png


缘由是:
it

springboot项目整合swagger要注意二者的版本,springboot项目的版本低,相应的swagger版本不能过高class


解决方案:

将swagger的版本提高至2.9.2,项目启动OK


image.png

相关文章
相关标签/搜索