Bläddra i källkod

update 优化 删除无用配置类

疯狂的狮子Li 1 år sedan
förälder
incheckning
bb475a6088

+ 4 - 8
ruoyi-admin/src/main/java/org/dromara/web/controller/IndexController.java

@@ -1,9 +1,9 @@
 package org.dromara.web.controller;
 
 import cn.dev33.satoken.annotation.SaIgnore;
-import org.dromara.common.core.config.RuoYiConfig;
-import org.dromara.common.core.utils.StringUtils;
 import lombok.RequiredArgsConstructor;
+import org.dromara.common.core.utils.SpringUtils;
+import org.dromara.common.core.utils.StringUtils;
 import org.springframework.web.bind.annotation.GetMapping;
 import org.springframework.web.bind.annotation.RestController;
 
@@ -17,16 +17,12 @@ import org.springframework.web.bind.annotation.RestController;
 @RestController
 public class IndexController {
 
-    /**
-     * 系统基础配置
-     */
-    private final RuoYiConfig ruoyiConfig;
-
     /**
      * 访问首页,提示语
      */
     @GetMapping("/")
     public String index() {
-        return StringUtils.format("欢迎使用{}后台管理框架,当前版本:v{},请通过前端地址访问。", ruoyiConfig.getName(), ruoyiConfig.getVersion());
+        return StringUtils.format("欢迎使用{}后台管理框架,请通过前端地址访问。", SpringUtils.getApplicationName());
     }
+
 }

+ 2 - 2
ruoyi-admin/src/main/resources/application-dev.yml

@@ -120,8 +120,8 @@ redisson:
   nettyThreads: 8
   # 单节点配置
   singleServerConfig:
-    # 客户端名称
-    clientName: ${ruoyi.name}
+    # 客户端名称 不能用中文
+    clientName: RuoYi-Vue-Plus
     # 最小空闲连接数
     connectionMinimumIdleSize: 8
     # 连接池大小

+ 2 - 2
ruoyi-admin/src/main/resources/application-prod.yml

@@ -123,8 +123,8 @@ redisson:
   nettyThreads: 32
   # 单节点配置
   singleServerConfig:
-    # 客户端名称
-    clientName: ${ruoyi.name}
+    # 客户端名称 不能用中文
+    clientName: RuoYi-Vue-Plus
     # 最小空闲连接数
     connectionMinimumIdleSize: 32
     # 连接池大小

+ 14 - 23
ruoyi-admin/src/main/resources/application.yml

@@ -1,24 +1,3 @@
-# 项目相关配置
-ruoyi:
-  # 名称
-  name: RuoYi-Vue-Plus
-  # 版本
-  version: ${revision}
-  # 版权年份
-  copyrightYear: 2024
-
-captcha:
-  enable: true
-  # 页面 <参数设置> 可开启关闭 验证码校验
-  # 验证码类型 math 数组计算 char 字符验证
-  type: MATH
-  # line 线段干扰 circle 圆圈干扰 shear 扭曲干扰
-  category: CIRCLE
-  # 数字验证码位数
-  numberLength: 1
-  # 字符验证码长度
-  charLength: 4
-
 # 开发环境配置
 server:
   # 服务器的HTTP端口,默认为8080
@@ -41,6 +20,18 @@ server:
       # 阻塞任务线程池, 当执行类似servlet请求阻塞操作, undertow会从这个线程池中取得线程,它的值设置取决于系统的负载
       worker: 256
 
+captcha:
+  enable: true
+  # 页面 <参数设置> 可开启关闭 验证码校验
+  # 验证码类型 math 数组计算 char 字符验证
+  type: MATH
+  # line 线段干扰 circle 圆圈干扰 shear 扭曲干扰
+  category: CIRCLE
+  # 数字验证码位数
+  numberLength: 1
+  # 字符验证码长度
+  charLength: 4
+
 # 日志配置
 logging:
   level:
@@ -61,7 +52,7 @@ user:
 # Spring配置
 spring:
   application:
-    name: ${ruoyi.name}
+    name: RuoYi-Vue-Plus
   threads:
     # 开启虚拟线程 仅jdk21可用
     virtual:
@@ -191,7 +182,7 @@ springdoc:
 #    persistAuthorization: true
   info:
     # 标题
-    title: '标题:${ruoyi.name}多租户管理系统_接口文档'
+    title: '标题:RuoYi-Vue-Plus多租户管理系统_接口文档'
     # 描述
     description: '描述:用于管理集团旗下公司的人员信息,具体包括XXX,XXX模块...'
     # 版本

+ 5 - 5
ruoyi-admin/src/test/java/org/dromara/test/DemoUnitTest.java

@@ -1,6 +1,6 @@
 package org.dromara.test;
 
-import org.dromara.common.core.config.RuoYiConfig;
+import org.dromara.common.web.config.properties.CaptchaProperties;
 import org.junit.jupiter.api.*;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.boot.test.context.SpringBootTest;
@@ -17,19 +17,19 @@ import java.util.concurrent.TimeUnit;
 public class DemoUnitTest {
 
     @Autowired
-    private RuoYiConfig ruoYiConfig;
+    private CaptchaProperties captchaProperties;
 
     @DisplayName("测试 @SpringBootTest @Test @DisplayName 注解")
     @Test
     public void testTest() {
-        System.out.println(ruoYiConfig);
+        System.out.println(captchaProperties);
     }
 
     @Disabled
     @DisplayName("测试 @Disabled 注解")
     @Test
     public void testDisabled() {
-        System.out.println(ruoYiConfig);
+        System.out.println(captchaProperties);
     }
 
     @Timeout(value = 2L, unit = TimeUnit.SECONDS)
@@ -37,7 +37,7 @@ public class DemoUnitTest {
     @Test
     public void testTimeout() throws InterruptedException {
         Thread.sleep(3000);
-        System.out.println(ruoYiConfig);
+        System.out.println(captchaProperties);
     }
 
 

+ 0 - 33
ruoyi-common/ruoyi-common-core/src/main/java/org/dromara/common/core/config/RuoYiConfig.java

@@ -1,33 +0,0 @@
-package org.dromara.common.core.config;
-
-import lombok.Data;
-import org.springframework.boot.context.properties.ConfigurationProperties;
-import org.springframework.stereotype.Component;
-
-/**
- * 读取项目相关配置
- *
- * @author Lion Li
- */
-
-@Data
-@Component
-@ConfigurationProperties(prefix = "ruoyi")
-public class RuoYiConfig {
-
-    /**
-     * 项目名称
-     */
-    private String name;
-
-    /**
-     * 版本
-     */
-    private String version;
-
-    /**
-     * 版权年份
-     */
-    private String copyrightYear;
-
-}

+ 0 - 1
ruoyi-common/ruoyi-common-core/src/main/resources/META-INF/spring/org.springframework.boot.autoconfigure.AutoConfiguration.imports

@@ -1,6 +1,5 @@
 org.dromara.common.core.config.ApplicationConfig
 org.dromara.common.core.config.AsyncConfig
-org.dromara.common.core.config.RuoYiConfig
 org.dromara.common.core.config.ThreadPoolConfig
 org.dromara.common.core.config.ValidatorConfig
 org.dromara.common.core.utils.SpringUtils