Browse Source

swagger3配置

tangzan 2 years ago
parent
commit
e58c7634b6

+ 0 - 7
spring-boot-swagger3-example/src/main/java/cn/metaq/example/SpringBootSwagger3ExampleApplication.java

@@ -1,20 +1,13 @@
 package cn.metaq.example;
 
-import io.swagger.annotations.ApiOperation;
 import org.springframework.boot.SpringApplication;
 import org.springframework.boot.autoconfigure.SpringBootApplication;
-import org.springframework.web.bind.annotation.GetMapping;
 import springfox.documentation.oas.annotations.EnableOpenApi;
 
 @EnableOpenApi
 @SpringBootApplication
 public class SpringBootSwagger3ExampleApplication {
 
-  @ApiOperation(value = "测试swagger的模拟接口")
-  @GetMapping("index")
-  public String index(){
-    return "success";
-  }
   public static void main(String[] args) {
     SpringApplication.run(SpringBootSwagger3ExampleApplication.class, args);
   }

+ 19 - 0
spring-boot-swagger3-example/src/main/java/cn/metaq/example/web/IndexController.java

@@ -0,0 +1,19 @@
+package cn.metaq.example.web;
+
+import io.swagger.annotations.Api;
+import io.swagger.annotations.ApiOperation;
+import org.springframework.web.bind.annotation.GetMapping;
+import org.springframework.web.bind.annotation.RestController;
+
+//@Tag(name = "IndexController",description = "测试接口")
+@Api(tags = "测试接口")
+@RestController
+public class IndexController {
+
+//  @Operation(description = "测试swagger的模拟接口d",summary = "测试swagger的模拟接口s")
+@ApiOperation(value = "查询远程数据库表结构详细信息")
+  @GetMapping("index")
+  public String index(){
+    return "success";
+  }
+}