这篇文章主要介绍了springboot怎么更新配置Swagger3的相关知识,内容详细易懂,操作简单快捷,具有一定借鉴价值,相信大家阅读完这篇springboot怎么更新配置Swagger3文章都会有所收获,下面我们一起来看看吧。
1.引入依赖,版本3.0.0只引入一个即可
<dependency>
<groupId>io.springfox</groupId>
<artifactId>springfox-boot-starter</artifactId>
<version>3.0.0</version>
</dependency>
2. 配置类SwaggerConfig
package org.fh.config;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import springfox.documentation.builders.ApiInfoBuilder;
import springfox.documentation.builders.PathSelectors;
import springfox.documentation.builders.RequestHandlerSelectors;
import springfox.documentation.oas.annotations.EnableOpenApi;
import springfox.documentation.service.ApiInfo;
import springfox.documentation.spi.DocumentationType;
import springfox.documentation.spring.web.plugins.Docket;
/**
* 说明:Swagger 接口API生成
* 作者:FH Admin
* from fhadmin.cn
*/
@Configuration
@EnableOpenApi
public class SwaggerConfig {
@Bean
public Docket createRestApi() {
return new Docket(DocumentationType.OAS_30)
.apiInfo(apiInfo())
.select()
.apis(RequestHandlerSelectors.basePackage("org.fh.controller")) // 为当前包路径
.paths(PathSelectors.any())
.build();
}
private ApiInfo apiInfo() {
return new ApiInfoBuilder()
.title("FH Admin Swagger3 RESTful API") // 页面标题
.version("3.0") // 版本号
.description("fhadmin.org") // 描述
.build();
}
}
3.Swagger 拦截配置
package org.fh.config;
import org.springframework.context.annotation.Configuration;
import org.springframework.web.servlet.config.annotation.ResourceHandlerRegistry;
import org.springframework.web.servlet.config.annotation.ViewControllerRegistry;
import org.springframework.web.servlet.config.annotation.WebMvcConfigurer;
/**
* 说明:Swagger 拦截配置
* 作者:FH Admin
* from fhadmin.cn
*/
@Configuration
public class WebMvcConfig implements WebMvcConfigurer {
@Override
public void addResourceHandlers(ResourceHandlerRegistry registry) {
registry.
addResourceHandler("/swagger-ui/**")
.addResourceLocations("classpath:/META-INF/resources/webjars/springfox-swagger-ui/")
.resourceChain(false);
}
@Override
public void addViewControllers(ViewControllerRegistry registry) {
registry.addViewController("/swagger-ui/")
.setViewName("forward:/swagger-ui/index.html");
}
}
4.访问 127.0.0.1:8081/swagger-ui/index.html
5.接口说明案例
处理类上加注解,比如
@Api("用户注册登录接口")
在方法上加注解,比如
@ApiOperation(value = "登录", notes="校验登录是否成功")
@ApiImplicitParam(name = "KEYDATA", value = "用户名密码混淆码组合", paramType = "query", required = true, dataType = "String")
工作流模块-------------------------------www.fhadmin.cn
1.模型管理:web在线流程设计器、导入导出xml、复制流程、部署流程
2.流程管理:导入导出流程资源文件、查看流程图、根据流程实例反射出流程模型、激活挂起
3.运行中流程:查看流程信息、当前任务节点、当前流程图、作废暂停流程、指派待办人、自由跳转
4.历史的流程:查看流程信息、流程用时、流程状态、查看任务发起人信息
5.待办任务:查看本人个人任务以及本角色下的任务、办理、驳回、作废、指派一下代理人
6.已办任务:查看自己办理过的任务以及流程信息、流程图、流程状态(作废 驳回 正常完成)
办理任务时候可以选择用户进行抄送,就是给被抄送人发送站内信通知当前审批意见以及备注信息
注:当办理完当前任务时,下一任务待办人会即时通讯收到新任务消息提醒,当作废和完结任务时,
任务发起人会收到站内信消息通知
关于“springboot怎么更新配置Swagger3”这篇文章的内容就介绍到这里,感谢各位的阅读!相信大家对“springboot怎么更新配置Swagger3”知识都有一定的了解,大家如果还想学习更多知识,欢迎关注亿速云行业资讯频道。
亿速云「云服务器」,即开即用、新一代英特尔至强铂金CPU、三副本存储NVMe SSD云盘,价格低至29元/月。点击查看>>
免责声明:本站发布的内容(图片、视频和文字)以原创、转载和分享为主,文章观点不代表本网站立场,如果涉及侵权请联系站长邮箱:is@yisu.com进行举报,并提供相关证据,一经查实,将立刻删除涉嫌侵权内容。
原文链接:https://www.jb51.net/web/7186.html