|
@@ -0,0 +1,39 @@
|
|
|
+package com.xy;
|
|
|
+
|
|
|
+import cn.torna.swaggerplugin.SwaggerPlugin;
|
|
|
+import lombok.SneakyThrows;
|
|
|
+import lombok.extern.slf4j.Slf4j;
|
|
|
+import org.springframework.boot.ApplicationArguments;
|
|
|
+import org.springframework.boot.ApplicationRunner;
|
|
|
+import org.springframework.context.annotation.Profile;
|
|
|
+import org.springframework.stereotype.Component;
|
|
|
+
|
|
|
+/**
|
|
|
+ * 指定测试环境启动运行,git push会重新启动并推送文档
|
|
|
+ */
|
|
|
+@Profile("uat")
|
|
|
+@Slf4j
|
|
|
+@Component
|
|
|
+public class PushDoc implements ApplicationRunner {
|
|
|
+
|
|
|
+ /**
|
|
|
+ * swagger文档推送到torna接口管理平台
|
|
|
+ */
|
|
|
+ @SneakyThrows
|
|
|
+ @Override
|
|
|
+ public void run(ApplicationArguments args) {
|
|
|
+ log.info("开始执行:swagger接口文档数据---->Torna");
|
|
|
+ SwaggerPlugin.pushDoc();
|
|
|
+ log.info("执行完成:swagger接口文档数据---->Torna");
|
|
|
+
|
|
|
+ }
|
|
|
+
|
|
|
+ /**
|
|
|
+ * 主动推送
|
|
|
+ *
|
|
|
+ * @param args
|
|
|
+ */
|
|
|
+ public static void main(String[] args) {
|
|
|
+ SwaggerPlugin.pushDoc();
|
|
|
+ }
|
|
|
+}
|