首页天道酬勤,

,

张世龙 05-05 21:20 77次浏览

1部署依赖关系

! - -依赖swagger---dependencygroupidio.spring fox/groupidartifactidspringfox-swagger2/artifactidversion2.4.0/versprs 向界面展示规范----dependencygroupidio.spring fox/groupidartifactidspringfox-swagger-ui/artifactidversion 2.4

package com.platform.config; importorg.spring帧work.context.annotation.bean; importorg.spring帧. context.annotation.components can; importorg.spring framework.context.annotation.configuration; importorg.spring framework.web.servlet.config.annotation.enablewebmvc; importspringfox.documentation.builders.path selectors; importspringfox.documentation.builders.requesthandlerselectors; importspringfox.documentation.service.API info; importspringfox.documentation.SPI.documentation type; importspringfox.documentation.spring.web.plugins.docket; importspringfox.documentation.swagger2. annotations.enable swagger 2;/* * * @ gitee https://gitee.com/Fuyang _ Li pengjun/platform */@ configuration @ enablewebmvc @ enable swager2@ comporaratior 此方法的返回值为Spring管理*/@ beanpublicdocketapi ({ return new docket ) documentation type.swagger _2}.API info (this.API info ) 文档. APIS ) requesthandlerselectors.base package (com.platform.apporm )/* * *此API集的说明包括作者、个人资料、版本、和privateAPIinfoAPIinfo () @suppresswarnings ) (deprecation ) )。“小程序接口文档”、“1.0”和“urn:tos” }} 4swagger配置文件的常规方法

地址: https://www.cn blogs.com/Mao 2080/p/9021714.html

使用swagger提供的注释

地址: https://blog.csdn.net/fans union/article/details/51923720

在ioc容器中注册swaggerconfig

添加配置类并自动创建bean。 不需要写xml@Configuration 5swaggerui

restful java,spring boot实战