From d150a8333d73e81a9e50b575462d1600f592cd90 Mon Sep 17 00:00:00 2001 From: YunaiV Date: Sat, 18 Jun 2022 09:22:38 +0800 Subject: [PATCH] =?UTF-8?q?=E6=96=B0=E5=A2=9E=20`yudao-spring-boot-starter?= =?UTF-8?q?-banner`=20=E7=BB=84=E4=BB=B6=EF=BC=8C=E7=94=A8=E4=BA=8E?= =?UTF-8?q?=E9=A1=B9=E7=9B=AE=E5=90=AF=E5=8A=A8=E6=97=B6=E6=89=93=E5=8D=B0?= =?UTF-8?q?=E5=BC=80=E5=8F=91=E6=96=87=E6=A1=A3=E3=80=81=E6=8E=A5=E5=8F=A3?= =?UTF-8?q?=E6=96=87=E6=A1=A3=E7=AD=89?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- yudao-dependencies/pom.xml | 5 +++ yudao-framework/pom.xml | 1 + .../yudao-spring-boot-starter-banner/pom.xml | 30 +++++++++++++++ .../config/YudaoBannerAutoConfiguration.java | 20 ++++++++++ .../banner/core/BannerApplicationRunner.java | 37 +++++++++++++++++++ .../yudao/framework/banner/package-info.java | 6 +++ .../main/resources/META-INF/spring.factories | 2 + .../src/main/resources/banner.txt | 0 .../YudaoDataPermissionAutoConfiguration.java | 2 +- .../config/YudaoTracerAutoConfiguration.java | 1 + yudao-gateway/pom.xml | 10 +++++ .../gateway/GatewayServerApplication.java | 8 +--- .../yudao-module-infra-biz/pom.xml | 4 ++ .../yudao-module-system-biz/pom.xml | 4 ++ .../src/main/resources/banner.txt | 17 --------- 归档/docs/README.md | 11 ------ 16 files changed, 122 insertions(+), 36 deletions(-) create mode 100644 yudao-framework/yudao-spring-boot-starter-banner/pom.xml create mode 100644 yudao-framework/yudao-spring-boot-starter-banner/src/main/java/cn/iocoder/yudao/framework/banner/config/YudaoBannerAutoConfiguration.java create mode 100644 yudao-framework/yudao-spring-boot-starter-banner/src/main/java/cn/iocoder/yudao/framework/banner/core/BannerApplicationRunner.java create mode 100644 yudao-framework/yudao-spring-boot-starter-banner/src/main/java/cn/iocoder/yudao/framework/banner/package-info.java create mode 100644 yudao-framework/yudao-spring-boot-starter-banner/src/main/resources/META-INF/spring.factories rename {yudao-module-infra/yudao-module-infra-biz => yudao-framework/yudao-spring-boot-starter-banner}/src/main/resources/banner.txt (100%) delete mode 100644 yudao-module-system/yudao-module-system-biz/src/main/resources/banner.txt delete mode 100644 归档/docs/README.md diff --git a/yudao-dependencies/pom.xml b/yudao-dependencies/pom.xml index d774250a1..c6cd6e496 100644 --- a/yudao-dependencies/pom.xml +++ b/yudao-dependencies/pom.xml @@ -95,6 +95,11 @@ + + cn.iocoder.cloud + yudao-spring-boot-starter-banner + ${revision} + cn.iocoder.cloud yudao-spring-boot-starter-biz-operatelog diff --git a/yudao-framework/pom.xml b/yudao-framework/pom.xml index b7afee01b..422a432cb 100644 --- a/yudao-framework/pom.xml +++ b/yudao-framework/pom.xml @@ -11,6 +11,7 @@ pom yudao-common + yudao-spring-boot-starter-banner yudao-spring-boot-starter-mybatis yudao-spring-boot-starter-redis yudao-spring-boot-starter-web diff --git a/yudao-framework/yudao-spring-boot-starter-banner/pom.xml b/yudao-framework/yudao-spring-boot-starter-banner/pom.xml new file mode 100644 index 000000000..9f4d1ded2 --- /dev/null +++ b/yudao-framework/yudao-spring-boot-starter-banner/pom.xml @@ -0,0 +1,30 @@ + + + + yudao-framework + cn.iocoder.cloud + ${revision} + + 4.0.0 + yudao-spring-boot-starter-banner + jar + + ${project.artifactId} + Banner 用于在 console 控制台,打印开发文档、接口文档等 + https://github.com/YunaiV/ruoyi-vue-pro + + + + cn.iocoder.cloud + yudao-common + + + + org.springframework.boot + spring-boot-starter + + + + diff --git a/yudao-framework/yudao-spring-boot-starter-banner/src/main/java/cn/iocoder/yudao/framework/banner/config/YudaoBannerAutoConfiguration.java b/yudao-framework/yudao-spring-boot-starter-banner/src/main/java/cn/iocoder/yudao/framework/banner/config/YudaoBannerAutoConfiguration.java new file mode 100644 index 000000000..2ae83f3f8 --- /dev/null +++ b/yudao-framework/yudao-spring-boot-starter-banner/src/main/java/cn/iocoder/yudao/framework/banner/config/YudaoBannerAutoConfiguration.java @@ -0,0 +1,20 @@ +package cn.iocoder.yudao.framework.banner.config; + +import cn.iocoder.yudao.framework.banner.core.BannerApplicationRunner; +import org.springframework.context.annotation.Bean; +import org.springframework.context.annotation.Configuration; + +/** + * Banner 的自动配置类 + * + * @author 芋道源码 + */ +@Configuration +public class YudaoBannerAutoConfiguration { + + @Bean + public BannerApplicationRunner bannerApplicationRunner() { + return new BannerApplicationRunner(); + } + +} diff --git a/yudao-framework/yudao-spring-boot-starter-banner/src/main/java/cn/iocoder/yudao/framework/banner/core/BannerApplicationRunner.java b/yudao-framework/yudao-spring-boot-starter-banner/src/main/java/cn/iocoder/yudao/framework/banner/core/BannerApplicationRunner.java new file mode 100644 index 000000000..bb6d2bfb4 --- /dev/null +++ b/yudao-framework/yudao-spring-boot-starter-banner/src/main/java/cn/iocoder/yudao/framework/banner/core/BannerApplicationRunner.java @@ -0,0 +1,37 @@ +package cn.iocoder.yudao.framework.banner.core; + +import cn.hutool.core.thread.ThreadUtil; +import lombok.extern.slf4j.Slf4j; +import org.springframework.boot.ApplicationArguments; +import org.springframework.boot.ApplicationRunner; +import org.springframework.stereotype.Component; + +import java.util.concurrent.TimeUnit; + +/** + * 项目启动成功后,提供文档相关的地址 + * + * @author 芋道源码 + */ +@Slf4j +public class BannerApplicationRunner implements ApplicationRunner { + + @Override + public void run(ApplicationArguments args) throws Exception { + ThreadUtil.execute(() -> { + ThreadUtil.sleep(1, TimeUnit.SECONDS); // 延迟 1 秒,保证输出到结尾 + log.info("\n----------------------------------------------------------\n\t" + + "项目启动成功!\n\t" + + "接口文档: \t{} \n\t" + + "开发文档: \t{} \n\t" + + "视频教程: \t{} \n\t" + + "源码解析: \t{} \n" + + "----------------------------------------------------------", + "https://doc.iocoder.cn/api-doc/", + "https://doc.iocoder.cn", + "https://t.zsxq.com/02Yf6M7Qn", + "https://t.zsxq.com/02B6ujIee"); + }); + } + +} diff --git a/yudao-framework/yudao-spring-boot-starter-banner/src/main/java/cn/iocoder/yudao/framework/banner/package-info.java b/yudao-framework/yudao-spring-boot-starter-banner/src/main/java/cn/iocoder/yudao/framework/banner/package-info.java new file mode 100644 index 000000000..aba726853 --- /dev/null +++ b/yudao-framework/yudao-spring-boot-starter-banner/src/main/java/cn/iocoder/yudao/framework/banner/package-info.java @@ -0,0 +1,6 @@ +/** + * Banner 用于在 console 控制台,打印开发文档、接口文档等 + * + * @author 芋道源码 + */ +package cn.iocoder.yudao.framework.banner; diff --git a/yudao-framework/yudao-spring-boot-starter-banner/src/main/resources/META-INF/spring.factories b/yudao-framework/yudao-spring-boot-starter-banner/src/main/resources/META-INF/spring.factories new file mode 100644 index 000000000..416b89477 --- /dev/null +++ b/yudao-framework/yudao-spring-boot-starter-banner/src/main/resources/META-INF/spring.factories @@ -0,0 +1,2 @@ +org.springframework.boot.autoconfigure.EnableAutoConfiguration=\ + cn.iocoder.yudao.framework.banner.config.YudaoBannerAutoConfiguration diff --git a/yudao-module-infra/yudao-module-infra-biz/src/main/resources/banner.txt b/yudao-framework/yudao-spring-boot-starter-banner/src/main/resources/banner.txt similarity index 100% rename from yudao-module-infra/yudao-module-infra-biz/src/main/resources/banner.txt rename to yudao-framework/yudao-spring-boot-starter-banner/src/main/resources/banner.txt diff --git a/yudao-framework/yudao-spring-boot-starter-biz-data-permission/src/main/java/cn/iocoder/yudao/framework/datapermission/config/YudaoDataPermissionAutoConfiguration.java b/yudao-framework/yudao-spring-boot-starter-biz-data-permission/src/main/java/cn/iocoder/yudao/framework/datapermission/config/YudaoDataPermissionAutoConfiguration.java index 609e8a34b..62534ed63 100644 --- a/yudao-framework/yudao-spring-boot-starter-biz-data-permission/src/main/java/cn/iocoder/yudao/framework/datapermission/config/YudaoDataPermissionAutoConfiguration.java +++ b/yudao-framework/yudao-spring-boot-starter-biz-data-permission/src/main/java/cn/iocoder/yudao/framework/datapermission/config/YudaoDataPermissionAutoConfiguration.java @@ -13,7 +13,7 @@ import org.springframework.context.annotation.Configuration; import java.util.List; /** - * 数据全新啊的自动配置类 + * 数据权限的自动配置类 * * @author 芋道源码 */ diff --git a/yudao-framework/yudao-spring-boot-starter-monitor/src/main/java/cn/iocoder/yudao/framework/tracer/config/YudaoTracerAutoConfiguration.java b/yudao-framework/yudao-spring-boot-starter-monitor/src/main/java/cn/iocoder/yudao/framework/tracer/config/YudaoTracerAutoConfiguration.java index ac76b9ed7..48414c02a 100644 --- a/yudao-framework/yudao-spring-boot-starter-monitor/src/main/java/cn/iocoder/yudao/framework/tracer/config/YudaoTracerAutoConfiguration.java +++ b/yudao-framework/yudao-spring-boot-starter-monitor/src/main/java/cn/iocoder/yudao/framework/tracer/config/YudaoTracerAutoConfiguration.java @@ -45,6 +45,7 @@ public class YudaoTracerAutoConfiguration { * 创建 TraceFilter 过滤器,响应 header 设置 traceId */ @Bean + @ConditionalOnClass(name = "javax.servlet.Filter") public FilterRegistrationBean traceFilter() { FilterRegistrationBean registrationBean = new FilterRegistrationBean<>(); registrationBean.setFilter(new TraceFilter()); diff --git a/yudao-gateway/pom.xml b/yudao-gateway/pom.xml index 8eef8c358..2d68e1c48 100644 --- a/yudao-gateway/pom.xml +++ b/yudao-gateway/pom.xml @@ -23,6 +23,10 @@ + + cn.iocoder.cloud + yudao-spring-boot-starter-banner + cn.iocoder.cloud yudao-module-system-api @@ -52,6 +56,12 @@ com.alibaba.cloud spring-cloud-starter-alibaba-nacos-config + + + + cn.iocoder.cloud + yudao-spring-boot-starter-monitor + diff --git a/yudao-gateway/src/main/java/cn/iocoder/yudao/gateway/GatewayServerApplication.java b/yudao-gateway/src/main/java/cn/iocoder/yudao/gateway/GatewayServerApplication.java index 3c04f086e..0db9b263d 100644 --- a/yudao-gateway/src/main/java/cn/iocoder/yudao/gateway/GatewayServerApplication.java +++ b/yudao-gateway/src/main/java/cn/iocoder/yudao/gateway/GatewayServerApplication.java @@ -9,14 +9,8 @@ import org.springframework.core.env.Environment; public class GatewayServerApplication { public static void main(String[] args) { -// SpringApplication.run(GatewayServerApplication.class, args); - // 启动 Spring Boot 应用 - ConfigurableApplicationContext context = SpringApplication.run(GatewayServerApplication.class, args); - - // 查看 Environment - Environment environment = context.getEnvironment(); - System.out.println(environment); + SpringApplication.run(GatewayServerApplication.class, args); } } diff --git a/yudao-module-infra/yudao-module-infra-biz/pom.xml b/yudao-module-infra/yudao-module-infra-biz/pom.xml index 2b8c66b25..bc0959d31 100644 --- a/yudao-module-infra/yudao-module-infra-biz/pom.xml +++ b/yudao-module-infra/yudao-module-infra-biz/pom.xml @@ -38,6 +38,10 @@ + + cn.iocoder.cloud + yudao-spring-boot-starter-banner + cn.iocoder.cloud yudao-spring-boot-starter-biz-operatelog diff --git a/yudao-module-system/yudao-module-system-biz/pom.xml b/yudao-module-system/yudao-module-system-biz/pom.xml index 50c31f866..a370bf1a3 100644 --- a/yudao-module-system/yudao-module-system-biz/pom.xml +++ b/yudao-module-system/yudao-module-system-biz/pom.xml @@ -37,6 +37,10 @@ + + cn.iocoder.cloud + yudao-spring-boot-starter-banner + cn.iocoder.cloud yudao-spring-boot-starter-biz-operatelog diff --git a/yudao-module-system/yudao-module-system-biz/src/main/resources/banner.txt b/yudao-module-system/yudao-module-system-biz/src/main/resources/banner.txt deleted file mode 100644 index 39a441d7d..000000000 --- a/yudao-module-system/yudao-module-system-biz/src/main/resources/banner.txt +++ /dev/null @@ -1,17 +0,0 @@ -芋道源码 http://www.iocoder.cn -Application Version: ${yudao.info.version} -Spring Boot Version: ${spring-boot.version} - -.__ __. ______ .______ __ __ _______ -| \ | | / __ \ | _ \ | | | | / _____| -| \| | | | | | | |_) | | | | | | | __ -| . ` | | | | | | _ < | | | | | | |_ | -| |\ | | `--' | | |_) | | `--' | | |__| | -|__| \__| \______/ |______/ \______/ \______| - -███╗ ██╗ ██████╗ ██████╗ ██╗ ██╗ ██████╗ -████╗ ██║██╔═══██╗ ██╔══██╗██║ ██║██╔════╝ -██╔██╗ ██║██║ ██║ ██████╔╝██║ ██║██║ ███╗ -██║╚██╗██║██║ ██║ ██╔══██╗██║ ██║██║ ██║ -██║ ╚████║╚██████╔╝ ██████╔╝╚██████╔╝╚██████╔╝ -╚═╝ ╚═══╝ ╚═════╝ ╚═════╝ ╚═════╝ ╚═════╝ diff --git a/归档/docs/README.md b/归档/docs/README.md deleted file mode 100644 index 14792d4a4..000000000 --- a/归档/docs/README.md +++ /dev/null @@ -1,11 +0,0 @@ - -* setup - > 提供安装指南 - * [搭建调试环境](https://gitee.com/zhijiantianya/onemall/docs/setup/quick-start.md) - -* sql - > 提供 SQL 文件 - -* guides - > 提供入门指南 - * TODO