zhijiezhao 1 năm trước cách đây
mục cha
commit
4ecaa897c2

+ 15 - 0
pom.xml

@@ -52,6 +52,21 @@
             </exclusions>
         </dependency>
 
+
+        <dependency>
+            <!--检测spring的web请求信息,生成检测结果(json格式) -->
+            <groupId>io.springfox</groupId>
+            <artifactId>springfox-swagger2</artifactId>
+            <version>2.9.2</version>
+        </dependency>
+        <dependency>
+            <!--根据springfox-swagger2生成的数据,生成可视化的友好页面 -->
+            <groupId>io.springfox</groupId>
+            <artifactId>springfox-swagger-ui</artifactId>
+            <version>2.9.2</version>
+        </dependency>
+
+
         <dependency>
             <groupId>mysql</groupId>
             <artifactId>mysql-connector-java</artifactId>

+ 1 - 1
src/main/java/com/caimei365/manager/config/security/SecurityConfig.java

@@ -44,7 +44,7 @@ public class SecurityConfig extends WebSecurityConfigurerAdapter {
     @Override
     public void configure(WebSecurity web) {
         // 需要放行的URL
-        web.ignoring().antMatchers("/register", "/hello","/formData/MultiPictareaddData");
+        web.ignoring().antMatchers("/register", "/hello","/formData/MultiPictareaddData","/swagger-ui/*");
     }
 
     /**

+ 21 - 0
src/main/java/com/caimei365/manager/controller/yanxuan/testApi.java

@@ -0,0 +1,21 @@
+package com.caimei365.manager.controller.yanxuan;
+
+import com.caimei365.manager.entity.ResponseJson;
+import com.caimei365.manager.utils.HttpUtil;
+import io.swagger.annotations.Api;
+import io.swagger.annotations.ApiOperation;
+import org.springframework.web.bind.annotation.GetMapping;
+import org.springframework.web.bind.annotation.RequestMapping;
+import org.springframework.web.bind.annotation.RestController;
+
+@RestController
+@RequestMapping("/yanxuan")
+@Api(tags = "测试")
+public class testApi {
+
+    @ApiOperation("测试接口")
+    @GetMapping("/test")
+    public ResponseJson test() {
+        return ResponseJson.success("测试");
+    }
+}

+ 7 - 0
src/main/resources/config/beta/application-beta.yml

@@ -86,3 +86,10 @@ fdfs:
     height: 150
   tracker-list:            #TrackerList参数,支持多个
     - 172.31.165.28:22122
+
+# swagger配置
+swagger:
+  # swagger开启状态,true开启,false关闭
+  enabled: true
+  ui-config:
+    operations-sorter: method

+ 7 - 0
src/main/resources/config/dev/application-dev.yml

@@ -87,3 +87,10 @@ fdfs:
 mybatis:
   configuration:
     log-impl: org.apache.ibatis.logging.stdout.StdOutImpl
+
+# swagger配置
+swagger:
+  # swagger开启状态,true开启,false关闭
+  enabled: true
+  ui-config:
+    operations-sorter: method