引用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只需引入三个即可

[html] view plaincopy
  1. <!-- swagger -->
  2. <dependency>
  3. <groupId>com.mangofactory</groupId>
  4. <artifactId>swagger-springmvc</artifactId>
  5. <version>1.0.2</version>
  6. </dependency>
  7. <dependency>
  8. <groupId>com.mangofactory</groupId>
  9. <artifactId>swagger-models</artifactId>
  10. <version>1.0.2</version>
  11. </dependency>
  12. <dependency>
  13. <groupId>com.wordnik</groupId>
  14. <artifactId>swagger-annotations</artifactId>
  15. <version>1.3.11</version>
  16. </dependency>

3.配置swaggerConfig.class 存放在com.thinkgem.jeesite.common.web下

@ComponentScan(basePackages ={"com.thinkgem.jeesite.modules.sys.web"})既扫描的路径根据自己的情况写

[java] view plaincopy
  1. package com.thinkgem.jeesite.common.web;
  2. import org.springframework.beans.factory.annotation.Autowired;
  3. import org.springframework.context.annotation.Bean;
  4. import org.springframework.context.annotation.ComponentScan;
  5. import org.springframework.context.annotation.Configuration;
  6. import org.springframework.web.servlet.config.annotation.DefaultServletHandlerConfigurer;
  7. import org.springframework.web.servlet.config.annotation.EnableWebMvc;
  8. import org.springframework.web.servlet.config.annotation.WebMvcConfigurerAdapter;
  9. import com.mangofactory.swagger.configuration.SpringSwaggerConfig;
  10. import com.mangofactory.swagger.models.dto.ApiInfo;
  11. import com.mangofactory.swagger.plugin.EnableSwagger;
  12. import com.mangofactory.swagger.plugin.SwaggerSpringMvcPlugin;
  13. /**
  14. * @author xiegx
  15. * @version 创建时间:2016-8-16 下午2:01:10
  16. * SwaggerUI配置
  17. */
  18. @Configuration
  19. @EnableSwagger
  20. @EnableWebMvc
  21. @ComponentScan(basePackages ={"com.thinkgem.jeesite.modules.sys.web"})  
  22. public class SwaggerConfig extends WebMvcConfigurerAdapter {
  23. private SpringSwaggerConfig springSwaggerConfig;
  24. /**
  25. * Required to autowire SpringSwaggerConfig
  26. */
  27. @Autowired
  28. public void setSpringSwaggerConfig(SpringSwaggerConfig springSwaggerConfig)
  29. {
  30. this.springSwaggerConfig = springSwaggerConfig;
  31. }
  32. /**
  33. * Every SwaggerSpringMvcPlugin bean is picked up by the swagger-mvc
  34. * framework - allowing for multiple swagger groups i.e. same code base
  35. * multiple swagger resource listings.
  36. */
  37. @Bean
  38. public SwaggerSpringMvcPlugin customImplementation()
  39. {
  40. return new SwaggerSpringMvcPlugin(this.springSwaggerConfig)
  41. .apiInfo(apiInfo())
  42. .includePatterns(".*")
  43. .swaggerGroup("XmPlatform")
  44. .apiVersion("1.0.0");
  45. }
  46. @Override
  47. public void configureDefaultServletHandling(DefaultServletHandlerConfigurer configurer) {
  48. configurer.enable();
  49. }
  50. /*
  51. * "标题 title",
  52. * "描述 description",
  53. * "termsOfServiceUrl",
  54. * "联系邮箱 contact email",
  55. * "许可证的类型 license type",
  56. * "许可证的链接 license url"
  57. */
  58. private ApiInfo apiInfo()
  59. {
  60. ApiInfo apiInfo = new ApiInfo(
  61. "Jeesite平台API文档",
  62. "后台RESTful API",
  63. "",//
  64. "admin@xmplatform.com",
  65. "",
  66. "");
  67. return apiInfo;
  68. }
  69. }

4.配置spring-mvc.xml

[html] view plaincopy
  1. <context:component-scan base-package="com.thinkgem.jeesite.modules.sys.web" use-default-filters="false">
  2. <context:include-filter type="annotation" expression="org.springframework.context.annotation.Configuration"/>
  3. </context:component-scan>

5.修改index.html

ip:端口号要根据自己需要的服务器对应的地址修改

6.启动工程

http://127.0.0.1:8080/jeesite/static/swagger/dist/index.html

jeesite项目集成swagger相关推荐

  1. swagger2maven依赖_Maven + SpringMVC项目集成Swagger

    Swagger 是一个规范和完整的框架,用于生成.描述.调用和可视化 RESTful 风格的 Web 服务.总体目标是使客户端和文件系统作为服务器以同样的速度来更新.文件的方法,参数和模型紧密集成到服 ...

  2. Springboot项目集成Swagger

    官网:https://swagger.io 一.准备工作 1). 导入knife4j的maven坐标 <dependency><groupId>com.github.xiaoy ...

  3. Spring Boot 集成 Swagger 生成 RESTful API 文档

    原文链接: Spring Boot 集成 Swagger 生成 RESTful API 文档 简介 Swagger 官网是这么描述它的:The Best APIs are Built with Swa ...

  4. springboot快速集成swagger

    今天技术总监说:小明,我们本次3.0改造,使用swagger2.0作为前后端分离的接口规范,它可以一键生成前后端的API,一劳永逸--小明:??? Spring Boot 框架是目前非常流行的微服务框 ...

  5. SpringBoot实战(八):集成Swagger

    强烈推荐一个大神的人工智能的教程:http://www.captainbed.net/zhanghan [前言] 前后端分离是现在系统的主流,前端人员更多专注于前端功能,后端人员更加关注后端极大提高开 ...

  6. SpringBoot15:集成Swagger Api问题

    项目集成Swagger 学习目标: 了解Swagger的概念及作用掌握在项目中集成Swagger自动生成API文档Swagger简介 前后端分离 前端 -> 前端控制层.视图层后端 -> ...

  7. 从0到1手把手搭建spring cloud alibaba 微服务大型应用框架(十五) swagger篇 : gateway 集成swagger 与 knife4j实现在线api文档并嵌入到自己项目内

    背景 我们日常开发中基本都是协同开发的,当然极个别的项目整体前后端都是一个人开发的,当多人协作时,尤其是前后端人员协同开发时 必然会面临着前端需要了解后端api接口的情况,两个选择,提前设计好文档,然 ...

  8. MP实战系列(二)之集成swagger

    其实与spring+springmvc+mybatis集成swagger没什么区别,只是之前写的太不好了,所以这次决定详细写. 提到swagger不得不提rest,rest是一种架构风格,里面有对不同 ...

  9. windows api中文文档_Web服务开发:Spring集成Swagger,3步自动生成API文档

    目录: 1,Spring Boot集成Swagger 2,Swagger接口文档页面 3,常见问题和解决方法 在Sping开发REST接口服务时,API文档是不可缺少的一个重要部分.Swagger框架 ...

最新文章

  1. GitHub标星3w+的项目,全面了解算法和数据结构知识
  2. C语言中的static 详细分析
  3. 【转】正则表达式简介及在C++11中的简单使用教程
  4. linux某个目录环境变量,在linux下加环境变量或者是把某个目录加到环境变量
  5. ABAP DESCRIBE语句
  6. python程序如何封装成接口_python接口自动化如何封装获取常量的类
  7. 服务器间 存活状态,Shell脚本监控LVS后台服务器存活状态
  8. 支持MySql的数据库自动分表工具DBShardTools发布
  9. 首都师范 博弈论 9 5 6引入精神奖励后的博弈模型
  10. 密码学之前后向安全性
  11. 使用单文档视图结构把Word嵌入到VC程序中(2)
  12. java put 请求_java发送put请求
  13. 应用程序界面开发 - 自定义用户控件布局控件的使用
  14. date_sub函数用法-----随笔记
  15. 唯美烟花特效登录页面,我感觉自己又行了
  16. 结构-02. 有理数加法
  17. win更新管理工具有用吗_7个非常有用的在线业务管理工具
  18. JavaScript——疑难杂症总结
  19. 关于Codeforce
  20. 全国计算机化学年会,俞汝勤院士获中国化学会首届计算机化学终身成就奖

热门文章

  1. DFU(Device Firmware Update)
  2. Java实现点分十进制IP和长整型转换
  3. 代替Win+R运行的小软件Launchy 2.5中文修改版 - 免安装压缩包
  4. 三大云平台的人工智能和大数据
  5. RK3326 移植FT6336U触摸屏驱动
  6. 解决部署报错No main manifest attribute, in XXX.jar
  7. 使用 技术可以把复杂的计算机网络简化,计算机网络试题及答案
  8. 超实用的ELK日志分析系统
  9. java 标准正态分布_java实现标准正态分布
  10. Vue之父传子,清晰易懂。