diff --git a/ruoyi-ui/package.json b/ruoyi-ui/package.json
index bacdcfa4..9331e89e 100644
--- a/ruoyi-ui/package.json
+++ b/ruoyi-ui/package.json
@@ -5,7 +5,7 @@
"author": "若依",
"license": "MIT",
"scripts": {
- "dev": "vue-cli-service serve",
+ "dev": "export NODE_OPTIONS=--openssl-legacy-provider && vue-cli-service serve",
"build:prod": "vue-cli-service build",
"build:stage": "vue-cli-service build --mode staging",
"preview": "node build/index.js --preview",
diff --git a/ruoyi-web/ruoyi-web-admin/pom.xml b/ruoyi-web/ruoyi-web-admin/pom.xml
index 366bbf95..af3c512e 100644
--- a/ruoyi-web/ruoyi-web-admin/pom.xml
+++ b/ruoyi-web/ruoyi-web-admin/pom.xml
@@ -48,6 +48,13 @@
${ruoyi.version}
+
+
+ com.ruoyi
+ ruoyi-gateway
+ ${ruoyi.version}
+
+
\ No newline at end of file
diff --git a/ruoyi-web/ruoyi-web-admin/src/main/java/com/ruoyi/web/admin/RuoYiWebAdminApplication.java b/ruoyi-web/ruoyi-web-admin/src/main/java/com/ruoyi/web/admin/RuoYiWebAdminApplication.java
index 142ad4da..1317af2c 100644
--- a/ruoyi-web/ruoyi-web-admin/src/main/java/com/ruoyi/web/admin/RuoYiWebAdminApplication.java
+++ b/ruoyi-web/ruoyi-web-admin/src/main/java/com/ruoyi/web/admin/RuoYiWebAdminApplication.java
@@ -2,6 +2,7 @@ package com.ruoyi.web.admin;
import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
+import org.springframework.context.annotation.ComponentScan;
import com.ruoyi.common.security.annotation.EnableCustomConfig;
import com.ruoyi.common.security.annotation.EnableRyFeignClients;
@@ -16,6 +17,7 @@ import com.ruoyi.common.swagger.annotation.EnableCustomSwagger2;
@EnableCustomSwagger2
@EnableRyFeignClients
@SpringBootApplication
+@ComponentScan("com.ruoyi")
public class RuoYiWebAdminApplication
{
public static void main(String[] args)
diff --git a/ruoyi-web/ruoyi-web-admin/src/main/java/com/ruoyi/web/admin/config/AutoPrefixConfiguration.java b/ruoyi-web/ruoyi-web-admin/src/main/java/com/ruoyi/web/admin/config/AutoPrefixConfiguration.java
new file mode 100644
index 00000000..0664e5be
--- /dev/null
+++ b/ruoyi-web/ruoyi-web-admin/src/main/java/com/ruoyi/web/admin/config/AutoPrefixConfiguration.java
@@ -0,0 +1,20 @@
+package com.ruoyi.web.admin.config;
+
+import org.springframework.boot.autoconfigure.web.servlet.WebMvcRegistrations;
+import org.springframework.stereotype.Component;
+import org.springframework.web.servlet.mvc.method.annotation.RequestMappingHandlerMapping;
+
+
+/**
+ * 自动补全路由前缀配置类
+ * @author 1763113879@qq.com
+ * @version V2.1
+ * @since 2.1.0 2023/11/15 14:48
+ */
+@Component
+public class AutoPrefixConfiguration implements WebMvcRegistrations {
+ @Override
+ public RequestMappingHandlerMapping getRequestMappingHandlerMapping() {
+ return new AutoPrefixUrlMapping();
+ }
+}
diff --git a/ruoyi-web/ruoyi-web-admin/src/main/java/com/ruoyi/web/admin/config/AutoPrefixUrlMapping.java b/ruoyi-web/ruoyi-web-admin/src/main/java/com/ruoyi/web/admin/config/AutoPrefixUrlMapping.java
new file mode 100644
index 00000000..bff6ff76
--- /dev/null
+++ b/ruoyi-web/ruoyi-web-admin/src/main/java/com/ruoyi/web/admin/config/AutoPrefixUrlMapping.java
@@ -0,0 +1,84 @@
+package com.ruoyi.web.admin.config;
+
+import java.lang.reflect.Method;
+import java.util.HashMap;
+import java.util.Map;
+import java.util.Objects;
+
+import org.springframework.web.servlet.mvc.method.RequestMappingInfo;
+import org.springframework.web.servlet.mvc.method.annotation.RequestMappingHandlerMapping;
+
+/**
+ * 按照目录结构/包名添加前缀
+ *
+ * @author 1763113879@qq.com
+ * @version V2.1
+ * @since 2.1.0 2023/11/15 14:20
+ */
+public class AutoPrefixUrlMapping extends RequestMappingHandlerMapping {
+
+ // 路由映射
+ static Map routesMap = new HashMap();
+
+ static {
+ // # 认证中心 uri: lb://ruoyi-auth
+ routesMap.put("com.ruoyi.auth.controller", "/auth");
+ // # 代码生成 uri: lb://ruoyi-gen
+ routesMap.put("com.ruoyi.gen.controller", "/code");
+ // # 定时任务 uri: lb://ruoyi-job
+ routesMap.put("com.ruoyi.job.controller", "/schedule");
+ // # 系统模块 uri: lb://ruoyi-system
+ routesMap.put("com.ruoyi.system.controller", "/system");
+ // # 文件服务 uri: lb://ruoyi-file
+ routesMap.put("com.ruoyi.file.controller", "/file");
+
+ }
+
+ /**
+ * 重写方法路由获取
+ *
+ * @param method
+ * @param handlerType
+ * @return
+ */
+ @Override
+ protected RequestMappingInfo getMappingForMethod(Method method, Class> handlerType) {
+ RequestMappingInfo mappingInfo = super.getMappingForMethod(method, handlerType);
+
+ if (Objects.nonNull(mappingInfo)) {
+ String prefix = this.getPrefix(handlerType);
+
+ if (prefix != null) {
+ String[] paths = mappingInfo.getPatternValues()
+ .stream()
+ .map(path -> prefix + path)
+ .toArray(String[]::new);
+
+ return mappingInfo.mutate()
+ .paths(paths)
+ .build();
+ }
+ }
+
+ return mappingInfo;
+ }
+
+ /**
+ * 获取方法路由前缀
+ *
+ * @param handleType
+ * @return
+ */
+ private String getPrefix(Class> handleType) {
+ String packageName = handleType.getPackage()
+ .getName();
+ // 使用foreach循环遍历HashMap 符合路由规则的添加前缀
+ for (String key : routesMap.keySet()) {
+ if (packageName.startsWith(key)) {
+ return routesMap.get(key);
+ }
+ }
+ return null;
+ }
+
+}
diff --git a/ruoyi-web/ruoyi-web-admin/src/main/resources/META-INF/spring/org.springframework.boot.autoconfigure.AutoConfiguration.imports b/ruoyi-web/ruoyi-web-admin/src/main/resources/META-INF/spring/org.springframework.boot.autoconfigure.AutoConfiguration.imports
new file mode 100644
index 00000000..e69de29b
diff --git a/ruoyi-web/ruoyi-web-admin/src/main/resources/application-druid.yml b/ruoyi-web/ruoyi-web-admin/src/main/resources/application-druid.yml
deleted file mode 100644
index d38b6dae..00000000
--- a/ruoyi-web/ruoyi-web-admin/src/main/resources/application-druid.yml
+++ /dev/null
@@ -1,61 +0,0 @@
-# 数据源配置
-spring:
- datasource:
- type: com.alibaba.druid.pool.DruidDataSource
- driverClassName: com.mysql.cj.jdbc.Driver
- druid:
- # 主库数据源
- master:
- url: jdbc:mysql://localhost:3306/ry-config?useUnicode=true&characterEncoding=utf8&zeroDateTimeBehavior=convertToNull&useSSL=true&serverTimezone=GMT%2B8
- username: root
- password: chenroot
- # 从库数据源
- slave:
- # 从数据源开关/默认关闭
- enabled: false
- url:
- username:
- password:
- # 初始连接数
- initialSize: 5
- # 最小连接池数量
- minIdle: 10
- # 最大连接池数量
- maxActive: 20
- # 配置获取连接等待超时的时间
- maxWait: 60000
- # 配置连接超时时间
- connectTimeout: 30000
- # 配置网络超时时间
- socketTimeout: 60000
- # 配置间隔多久才进行一次检测,检测需要关闭的空闲连接,单位是毫秒
- timeBetweenEvictionRunsMillis: 60000
- # 配置一个连接在池中最小生存的时间,单位是毫秒
- minEvictableIdleTimeMillis: 300000
- # 配置一个连接在池中最大生存的时间,单位是毫秒
- maxEvictableIdleTimeMillis: 900000
- # 配置检测连接是否有效
- validationQuery: SELECT 1 FROM DUAL
- testWhileIdle: true
- testOnBorrow: false
- testOnReturn: false
- webStatFilter:
- enabled: true
- statViewServlet:
- enabled: true
- # 设置白名单,不填则允许所有访问
- allow:
- url-pattern: /druid/*
- # 控制台管理用户名和密码
- login-username: ruoyi
- login-password: 123456
- filter:
- stat:
- enabled: true
- # 慢SQL记录
- log-slow-sql: true
- slow-sql-millis: 1000
- merge-sql: true
- wall:
- config:
- multi-statement-allow: true
\ No newline at end of file
diff --git a/ruoyi-web/ruoyi-web-admin/src/main/resources/application.yml b/ruoyi-web/ruoyi-web-admin/src/main/resources/application-local.yml
similarity index 57%
rename from ruoyi-web/ruoyi-web-admin/src/main/resources/application.yml
rename to ruoyi-web/ruoyi-web-admin/src/main/resources/application-local.yml
index cef4d2d7..bd46ef14 100644
--- a/ruoyi-web/ruoyi-web-admin/src/main/resources/application.yml
+++ b/ruoyi-web/ruoyi-web-admin/src/main/resources/application-local.yml
@@ -1,7 +1,7 @@
# 项目相关配置
ruoyi:
# 名称
- name: RuoYi
+ name: ruoyi-web-admin
# 版本
version: 3.8.6
# 版权年份
@@ -53,8 +53,6 @@ spring:
messages:
# 国际化资源文件路径
basename: i18n/messages
- profiles:
- active: druid
# 文件上传
servlet:
multipart:
@@ -67,6 +65,41 @@ spring:
restart:
# 热部署开关
enabled: true
+ datasource:
+ druid:
+ stat-view-servlet:
+ enabled: true
+ loginUsername: admin
+ loginPassword: 123456
+ dynamic:
+ druid:
+ initial-size: 5
+ min-idle: 5
+ maxActive: 20
+ maxWait: 60000
+ timeBetweenEvictionRunsMillis: 60000
+ minEvictableIdleTimeMillis: 300000
+ validationQuery: SELECT 1 FROM DUAL
+ testWhileIdle: true
+ testOnBorrow: false
+ testOnReturn: false
+ poolPreparedStatements: true
+ maxPoolPreparedStatementPerConnectionSize: 20
+ filters: stat,slf4j
+ connectionProperties: druid.stat.mergeSql\=true;druid.stat.slowSqlMillis\=5000
+ datasource:
+ # 主库数据源
+ master:
+ driver-class-name: com.mysql.cj.jdbc.Driver
+ url: jdbc:mysql://localhost:3306/ry-config?useUnicode=true&characterEncoding=utf8&zeroDateTimeBehavior=convertToNull&useSSL=true&serverTimezone=GMT%2B8
+ username: root
+ password: chenroot
+ # 备库数据源
+ slave:
+ driver-class-name: com.mysql.cj.jdbc.Driver
+ url: jdbc:mysql://localhost:3306/ry-config?useUnicode=true&characterEncoding=utf8&zeroDateTimeBehavior=convertToNull&useSSL=true&serverTimezone=GMT%2B8
+ username: root
+ password: chenroot
# redis 配置
redis:
# 地址
@@ -89,7 +122,7 @@ spring:
max-active: 8
# #连接池最大阻塞等待时间(使用负值表示没有限制)
max-wait: -1ms
-#禁用nacos,yml文件
+ #禁用nacos,yml文件
cloud:
nacos:
config:
@@ -99,6 +132,8 @@ spring:
enabled: false
instance-enabled: false
+ main:
+ allow-bean-definition-overriding: true
# token配置
token:
# 令牌自定义标识
@@ -138,3 +173,47 @@ xss:
excludes: /system/notice
# 匹配链接
urlPatterns: /system/*,/monitor/*,/tool/*
+
+
+# 安全配置
+security:
+ # 验证码
+ captcha:
+ enabled: true
+ type: math
+ # 防止XSS攻击
+ xss:
+ enabled: true
+ excludeUrls:
+ - /system/notice
+ # 不校验白名单
+ ignore:
+ whites:
+ - /auth/logout
+ - /auth/login
+ - /auth/register
+ - /*/v2/api-docs
+ - /csrf
+
+##################### 文件模块 ###########################################
+# 本地文件上传
+file:
+ domain: http://127.0.0.1:9300
+ path: ruoyi/uploadPath
+ prefix: /statics
+
+# FastDFS配置
+fdfs:
+ domain: http://8.129.231.12
+ soTimeout: 3000
+ connectTimeout: 2000
+ trackerList: 8.129.231.12:22122
+
+# Minio配置
+minio:
+ url: http://8.129.231.12:9000
+ accessKey: minioadmin
+ secretKey: minioadmin
+ bucketName: test
+
+######################## 文件模块 ########################################
diff --git a/ruoyi-web/ruoyi-web-admin/src/main/resources/bootstrap.yml b/ruoyi-web/ruoyi-web-admin/src/main/resources/bootstrap.yml
new file mode 100644
index 00000000..5a2ccaaa
--- /dev/null
+++ b/ruoyi-web/ruoyi-web-admin/src/main/resources/bootstrap.yml
@@ -0,0 +1,79 @@
+# Tomcat
+server:
+ port: 8080
+
+# Spring
+spring:
+ application:
+ # 应用名称
+ name: ruoyi-web-admin
+ profiles:
+ # 环境配置
+ active: local
+
+ # Spring Web 公共配置
+ autoconfigure:
+ exclude: com.alibaba.druid.spring.boot.autoconfigure.DruidDataSourceAutoConfigure
+ mvc:
+ pathmatch:
+ matching-strategy: ant_path_matcher
+ cloud:
+ gateway:
+ discovery:
+ locator:
+ lowerCaseServiceId: true
+ enabled: true
+
+# feign 配置
+feign:
+ sentinel:
+ enabled: true
+ okhttp:
+ enabled: true
+ httpclient:
+ enabled: false
+ client:
+ config:
+ default:
+ connectTimeout: 10000
+ readTimeout: 10000
+ compression:
+ request:
+ enabled: true
+ response:
+ enabled: true
+
+# 暴露监控端点
+management:
+ endpoints:
+ web:
+ exposure:
+ include: '*'
+
+
+
+# 安全配置
+security:
+ # 验证码
+ captcha:
+ enabled: true
+ type: math
+ # 防止XSS攻击
+ xss:
+ enabled: true
+ excludeUrls:
+ - /system/notice
+ # 不校验白名单
+ ignore:
+ whites:
+ - /auth/logout
+ - /auth/login
+ - /auth/register
+ - /*/v2/api-docs
+ - /csrf
+
+# swagger配置
+swagger:
+ title: 系统模块接口文档
+ license: Powered By ruoyi
+ licenseUrl: https://ruoyi.vip
\ No newline at end of file
diff --git a/ruoyi-web/ruoyi-web-admin/src/main/resources/logback.xml b/ruoyi-web/ruoyi-web-admin/src/main/resources/logback.xml
index 08c44c72..e50a6bb1 100644
--- a/ruoyi-web/ruoyi-web-admin/src/main/resources/logback.xml
+++ b/ruoyi-web/ruoyi-web-admin/src/main/resources/logback.xml
@@ -67,7 +67,7 @@
-
+