Selaa lähdekoodia

update swagger 模板修改为 swagger-bootstrap-ui

疯狂的狮子li 4 vuotta sitten
vanhempi
commit
63a582404b

+ 1 - 0
README.md

@@ -24,6 +24,7 @@
 * 容器改动 Tomcat 改为 并发性能更好的 undertow
 * 代码生成模板 改为适配 Mybatis-Plus 的代码
 * 项目修改为 maven多环境配置
+* swagger 修改为 swagger-bootstrap-ui
 * 集成 Hutool 5.X 并重写RuoYi部分功能
 * 集成 Feign 接口化管理 Http 请求(如三方请求 支付,短信,推送等)
 * 升级MybatisPlus 3.4.2

+ 6 - 20
pom.xml

@@ -20,6 +20,7 @@
         <maven-jar-plugin.version>3.1.1</maven-jar-plugin.version>
         <druid.version>1.2.4</druid.version>
         <swagger.version>2.9.2</swagger.version>
+        <swagger-ui.version>1.9.6</swagger-ui.version>
         <pagehelper.boot.version>1.3.0</pagehelper.boot.version>
         <fastjson.version>1.2.75</fastjson.version>
         <oshi.version>5.6.0</oshi.version>
@@ -84,7 +85,7 @@
                 <artifactId>jna-platform</artifactId>
                 <version>${jna.version}</version>
             </dependency>
-			
+
             <!-- swagger2-->
             <dependency>
                 <groupId>io.springfox</groupId>
@@ -101,26 +102,11 @@
                     </exclusion>
                 </exclusions>
             </dependency>
-			
-            <!-- swagger2-UI-->
-            <dependency>
-                <groupId>io.springfox</groupId>
-                <artifactId>springfox-swagger-ui</artifactId>
-                <version>${swagger.version}</version>
-            </dependency>
-            
-            <!--io常用工具类 -->
-            <dependency>
-                <groupId>commons-io</groupId>
-                <artifactId>commons-io</artifactId>
-                <version>${commons.io.version}</version>
-            </dependency>
-	
-            <!--文件上传工具类 -->
+
             <dependency>
-                <groupId>commons-fileupload</groupId>
-                <artifactId>commons-fileupload</artifactId>
-                <version>${commons.fileupload.version}</version>
+                <groupId>com.github.xiaoymin</groupId>
+                <artifactId>swagger-bootstrap-ui</artifactId>
+                <version>${swagger-ui.version}</version>
             </dependency>
 			
             <!-- excel工具 -->

+ 2 - 3
ruoyi-admin/pom.xml

@@ -43,10 +43,9 @@
             <version>1.5.21</version>
         </dependency>
 
-        <!-- swagger2-UI-->
         <dependency>
-            <groupId>io.springfox</groupId>
-            <artifactId>springfox-swagger-ui</artifactId>
+            <groupId>com.github.xiaoymin</groupId>
+            <artifactId>swagger-bootstrap-ui</artifactId>
         </dependency>
 
          <!-- Mysql驱动包 -->

+ 0 - 24
ruoyi-admin/src/main/java/com/ruoyi/web/controller/tool/SwaggerController.java

@@ -1,24 +0,0 @@
-package com.ruoyi.web.controller.tool;
-
-import org.springframework.security.access.prepost.PreAuthorize;
-import org.springframework.stereotype.Controller;
-import org.springframework.web.bind.annotation.GetMapping;
-import org.springframework.web.bind.annotation.RequestMapping;
-import com.ruoyi.common.core.controller.BaseController;
-
-/**
- * swagger 接口
- * 
- * @author ruoyi
- */
-@Controller
-@RequestMapping("/tool/swagger")
-public class SwaggerController extends BaseController
-{
-    @PreAuthorize("@ss.hasPermi('tool:swagger:view')")
-    @GetMapping()
-    public String index()
-    {
-        return redirect("/swagger-ui.html");
-    }
-}

+ 8 - 9
ruoyi-admin/src/main/java/com/ruoyi/web/core/config/SwaggerConfig.java

@@ -1,26 +1,24 @@
 package com.ruoyi.web.core.config;
 
-import java.util.ArrayList;
-import java.util.List;
+import com.github.xiaoymin.swaggerbootstrapui.annotations.EnableSwaggerBootstrapUI;
+import com.ruoyi.common.config.RuoYiConfig;
+import io.swagger.annotations.ApiOperation;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.beans.factory.annotation.Value;
 import org.springframework.context.annotation.Bean;
 import org.springframework.context.annotation.Configuration;
-import com.ruoyi.common.config.RuoYiConfig;
-import io.swagger.annotations.ApiOperation;
 import springfox.documentation.builders.ApiInfoBuilder;
 import springfox.documentation.builders.PathSelectors;
 import springfox.documentation.builders.RequestHandlerSelectors;
-import springfox.documentation.service.ApiInfo;
-import springfox.documentation.service.ApiKey;
-import springfox.documentation.service.AuthorizationScope;
-import springfox.documentation.service.Contact;
-import springfox.documentation.service.SecurityReference;
+import springfox.documentation.service.*;
 import springfox.documentation.spi.DocumentationType;
 import springfox.documentation.spi.service.contexts.SecurityContext;
 import springfox.documentation.spring.web.plugins.Docket;
 import springfox.documentation.swagger2.annotations.EnableSwagger2;
 
+import java.util.ArrayList;
+import java.util.List;
+
 /**
  * Swagger2的接口配置
  * 
@@ -28,6 +26,7 @@ import springfox.documentation.swagger2.annotations.EnableSwagger2;
  */
 @Configuration
 @EnableSwagger2
+@EnableSwaggerBootstrapUI
 public class SwaggerConfig
 {
     /** 系统基础配置 */

+ 0 - 6
ruoyi-common/pom.xml

@@ -95,12 +95,6 @@
             <artifactId>commons-pool2</artifactId>
         </dependency>
 
-        <!-- 解析客户端操作系统、浏览器等 -->
-        <dependency>
-            <groupId>eu.bitwalker</groupId>
-            <artifactId>UserAgentUtils</artifactId>
-        </dependency>
-
         <!-- servlet包 -->
         <dependency>
             <groupId>javax.servlet</groupId>

+ 1 - 1
ruoyi-ui/src/views/tool/swagger/index.vue

@@ -8,7 +8,7 @@ export default {
   name: "Swagger",
   data() {
     return {
-      src: process.env.VUE_APP_BASE_API + "/swagger-ui.html",
+      src: process.env.VUE_APP_BASE_API + "/doc.html",
       height: document.documentElement.clientHeight - 94.5 + "px;",
       loading: true
     };