jeesite项目集成swagger
引用https://blog.csdn.net/opopopwqwqwq/article/details/75087748
1.下载swagger UI
https://github.com/swagger-api/swagger-ui/releases
解压 swagger直接放到jeesite项目的jeesite项目名\src\main\webapp\static\下 就可以 例如:
2.jar引用
jeesite项目pom.xml只需引入三个即可
- <!-- swagger -->
- <dependency>
- <groupId>com.mangofactory</groupId>
- <artifactId>swagger-springmvc</artifactId>
- <version>1.0.2</version>
- </dependency>
- <dependency>
- <groupId>com.mangofactory</groupId>
- <artifactId>swagger-models</artifactId>
- <version>1.0.2</version>
- </dependency>
- <dependency>
- <groupId>com.wordnik</groupId>
- <artifactId>swagger-annotations</artifactId>
- <version>1.3.11</version>
- </dependency>
3.配置swaggerConfig.class 存放在com.thinkgem.jeesite.common.web下
@ComponentScan(basePackages ={"com.thinkgem.jeesite.modules.sys.web"})既扫描的路径根据自己的情况写
- package com.thinkgem.jeesite.common.web;
- import org.springframework.beans.factory.annotation.Autowired;
- import org.springframework.context.annotation.Bean;
- import org.springframework.context.annotation.ComponentScan;
- import org.springframework.context.annotation.Configuration;
- import org.springframework.web.servlet.config.annotation.DefaultServletHandlerConfigurer;
- import org.springframework.web.servlet.config.annotation.EnableWebMvc;
- import org.springframework.web.servlet.config.annotation.WebMvcConfigurerAdapter;
- import com.mangofactory.swagger.configuration.SpringSwaggerConfig;
- import com.mangofactory.swagger.models.dto.ApiInfo;
- import com.mangofactory.swagger.plugin.EnableSwagger;
- import com.mangofactory.swagger.plugin.SwaggerSpringMvcPlugin;
- /**
- * @author xiegx
- * @version 创建时间:2016-8-16 下午2:01:10
- * SwaggerUI配置
- */
- @Configuration
- @EnableSwagger
- @EnableWebMvc
- @ComponentScan(basePackages ={"com.thinkgem.jeesite.modules.sys.web"})
- public class SwaggerConfig extends WebMvcConfigurerAdapter {
- private SpringSwaggerConfig springSwaggerConfig;
- /**
- * Required to autowire SpringSwaggerConfig
- */
- @Autowired
- public void setSpringSwaggerConfig(SpringSwaggerConfig springSwaggerConfig)
- {
- this.springSwaggerConfig = springSwaggerConfig;
- }
- /**
- * Every SwaggerSpringMvcPlugin bean is picked up by the swagger-mvc
- * framework - allowing for multiple swagger groups i.e. same code base
- * multiple swagger resource listings.
- */
- @Bean
- public SwaggerSpringMvcPlugin customImplementation()
- {
- return new SwaggerSpringMvcPlugin(this.springSwaggerConfig)
- .apiInfo(apiInfo())
- .includePatterns(".*")
- .swaggerGroup("XmPlatform")
- .apiVersion("1.0.0");
- }
- @Override
- public void configureDefaultServletHandling(DefaultServletHandlerConfigurer configurer) {
- configurer.enable();
- }
- /*
- * "标题 title",
- * "描述 description",
- * "termsOfServiceUrl",
- * "联系邮箱 contact email",
- * "许可证的类型 license type",
- * "许可证的链接 license url"
- */
- private ApiInfo apiInfo()
- {
- ApiInfo apiInfo = new ApiInfo(
- "Jeesite平台API文档",
- "后台RESTful API",
- "",//
- "admin@xmplatform.com",
- "",
- "");
- return apiInfo;
- }
- }
4.配置spring-mvc.xml
- <context:component-scan base-package="com.thinkgem.jeesite.modules.sys.web" use-default-filters="false">
- <context:include-filter type="annotation" expression="org.springframework.context.annotation.Configuration"/>
- </context:component-scan>
5.修改index.html
6.启动工程
http://127.0.0.1:8080/jeesite/static/swagger/dist/index.html
jeesite项目集成swagger相关推荐
- swagger2maven依赖_Maven + SpringMVC项目集成Swagger
Swagger 是一个规范和完整的框架,用于生成.描述.调用和可视化 RESTful 风格的 Web 服务.总体目标是使客户端和文件系统作为服务器以同样的速度来更新.文件的方法,参数和模型紧密集成到服 ...
- Springboot项目集成Swagger
官网:https://swagger.io 一.准备工作 1). 导入knife4j的maven坐标 <dependency><groupId>com.github.xiaoy ...
- Spring Boot 集成 Swagger 生成 RESTful API 文档
原文链接: Spring Boot 集成 Swagger 生成 RESTful API 文档 简介 Swagger 官网是这么描述它的:The Best APIs are Built with Swa ...
- springboot快速集成swagger
今天技术总监说:小明,我们本次3.0改造,使用swagger2.0作为前后端分离的接口规范,它可以一键生成前后端的API,一劳永逸--小明:??? Spring Boot 框架是目前非常流行的微服务框 ...
- SpringBoot实战(八):集成Swagger
强烈推荐一个大神的人工智能的教程:http://www.captainbed.net/zhanghan [前言] 前后端分离是现在系统的主流,前端人员更多专注于前端功能,后端人员更加关注后端极大提高开 ...
- SpringBoot15:集成Swagger Api问题
项目集成Swagger 学习目标: 了解Swagger的概念及作用掌握在项目中集成Swagger自动生成API文档Swagger简介 前后端分离 前端 -> 前端控制层.视图层后端 -> ...
- 从0到1手把手搭建spring cloud alibaba 微服务大型应用框架(十五) swagger篇 : gateway 集成swagger 与 knife4j实现在线api文档并嵌入到自己项目内
背景 我们日常开发中基本都是协同开发的,当然极个别的项目整体前后端都是一个人开发的,当多人协作时,尤其是前后端人员协同开发时 必然会面临着前端需要了解后端api接口的情况,两个选择,提前设计好文档,然 ...
- MP实战系列(二)之集成swagger
其实与spring+springmvc+mybatis集成swagger没什么区别,只是之前写的太不好了,所以这次决定详细写. 提到swagger不得不提rest,rest是一种架构风格,里面有对不同 ...
- windows api中文文档_Web服务开发:Spring集成Swagger,3步自动生成API文档
目录: 1,Spring Boot集成Swagger 2,Swagger接口文档页面 3,常见问题和解决方法 在Sping开发REST接口服务时,API文档是不可缺少的一个重要部分.Swagger框架 ...
最新文章
- GitHub标星3w+的项目,全面了解算法和数据结构知识
- C语言中的static 详细分析
- 【转】正则表达式简介及在C++11中的简单使用教程
- linux某个目录环境变量,在linux下加环境变量或者是把某个目录加到环境变量
- ABAP DESCRIBE语句
- python程序如何封装成接口_python接口自动化如何封装获取常量的类
- 服务器间 存活状态,Shell脚本监控LVS后台服务器存活状态
- 支持MySql的数据库自动分表工具DBShardTools发布
- 首都师范 博弈论 9 5 6引入精神奖励后的博弈模型
- 密码学之前后向安全性
- 使用单文档视图结构把Word嵌入到VC程序中(2)
- java put 请求_java发送put请求
- 应用程序界面开发 - 自定义用户控件布局控件的使用
- date_sub函数用法-----随笔记
- 唯美烟花特效登录页面,我感觉自己又行了
- 结构-02. 有理数加法
- win更新管理工具有用吗_7个非常有用的在线业务管理工具
- JavaScript——疑难杂症总结
- 关于Codeforce
- 全国计算机化学年会,俞汝勤院士获中国化学会首届计算机化学终身成就奖