mirror of
https://gitee.com/huangge1199_admin/vue-pro.git
synced 2024-11-26 01:01:52 +08:00
1. 禁用 member 模块
2. 减少 mybatis 日志打印 3. 降低 local 环境的初始连接 目的:提升项目的启动速度
This commit is contained in:
parent
62c4838ba7
commit
50371b3676
@ -1,42 +0,0 @@
|
|||||||
package cn.iocoder.yudao.framework.tenant.core.job;
|
|
||||||
|
|
||||||
import cn.iocoder.yudao.framework.tenant.core.service.TenantFrameworkService;
|
|
||||||
import cn.iocoder.yudao.framework.test.core.ut.BaseMockitoUnitTest;
|
|
||||||
import com.google.common.collect.Lists;
|
|
||||||
import org.junit.jupiter.api.Test;
|
|
||||||
import org.mockito.Mock;
|
|
||||||
import org.mockito.Mockito;
|
|
||||||
|
|
||||||
import java.util.List;
|
|
||||||
|
|
||||||
import static org.junit.jupiter.api.Assertions.assertEquals;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 验证 job 租户逻辑
|
|
||||||
* {@link TenantJobHandlerDecorator}
|
|
||||||
*
|
|
||||||
* @author gaibu
|
|
||||||
*/
|
|
||||||
public class TenantJobTest extends BaseMockitoUnitTest {
|
|
||||||
|
|
||||||
@Mock
|
|
||||||
TenantFrameworkService tenantFrameworkService;
|
|
||||||
|
|
||||||
@Test
|
|
||||||
public void test() throws Exception {
|
|
||||||
// 准备测试租户 id
|
|
||||||
List<Long> tenantIds = Lists.newArrayList(1L, 2L, 3L);
|
|
||||||
// mock 数据
|
|
||||||
Mockito.doReturn(tenantIds).when(tenantFrameworkService).getTenantIds();
|
|
||||||
// 准备测试任务
|
|
||||||
TestJob testJob = new TestJob();
|
|
||||||
// 创建任务装饰器
|
|
||||||
TenantJobHandlerDecorator tenantJobHandlerDecorator = new TenantJobHandlerDecorator(tenantFrameworkService, testJob);
|
|
||||||
|
|
||||||
// 执行任务
|
|
||||||
tenantJobHandlerDecorator.execute(null);
|
|
||||||
|
|
||||||
// 断言返回值
|
|
||||||
assertEquals(testJob.getTenantIds(), tenantIds);
|
|
||||||
}
|
|
||||||
}
|
|
@ -9,12 +9,12 @@ import java.util.List;
|
|||||||
import java.util.concurrent.CopyOnWriteArrayList;
|
import java.util.concurrent.CopyOnWriteArrayList;
|
||||||
|
|
||||||
@Component
|
@Component
|
||||||
@TenantJob // 标记多租户
|
|
||||||
public class TestJob implements JobHandler {
|
public class TestJob implements JobHandler {
|
||||||
|
|
||||||
private final List<Long> tenantIds = new CopyOnWriteArrayList<>();
|
private final List<Long> tenantIds = new CopyOnWriteArrayList<>();
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
@TenantJob // 标记多租户
|
||||||
public String execute(String param) throws Exception {
|
public String execute(String param) throws Exception {
|
||||||
tenantIds.add(TenantContextHolder.getTenantId());
|
tenantIds.add(TenantContextHolder.getTenantId());
|
||||||
return "success";
|
return "success";
|
||||||
@ -24,4 +24,5 @@ public class TestJob implements JobHandler {
|
|||||||
CollUtil.sort(tenantIds, Long::compareTo);
|
CollUtil.sort(tenantIds, Long::compareTo);
|
||||||
return tenantIds;
|
return tenantIds;
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -21,11 +21,6 @@
|
|||||||
<url>https://github.com/YunaiV/ruoyi-vue-pro</url>
|
<url>https://github.com/YunaiV/ruoyi-vue-pro</url>
|
||||||
|
|
||||||
<dependencies>
|
<dependencies>
|
||||||
<dependency>
|
|
||||||
<groupId>cn.iocoder.boot</groupId>
|
|
||||||
<artifactId>yudao-module-member-biz</artifactId>
|
|
||||||
<version>${revision}</version>
|
|
||||||
</dependency>
|
|
||||||
<dependency>
|
<dependency>
|
||||||
<groupId>cn.iocoder.boot</groupId>
|
<groupId>cn.iocoder.boot</groupId>
|
||||||
<artifactId>yudao-module-system-biz</artifactId>
|
<artifactId>yudao-module-system-biz</artifactId>
|
||||||
@ -41,6 +36,13 @@
|
|||||||
<artifactId>yudao-spring-boot-starter-biz-error-code</artifactId>
|
<artifactId>yudao-spring-boot-starter-biz-error-code</artifactId>
|
||||||
</dependency>
|
</dependency>
|
||||||
|
|
||||||
|
<!-- 会员中心。默认注释,保证编译速度 -->
|
||||||
|
<!-- <dependency>-->
|
||||||
|
<!-- <groupId>cn.iocoder.boot</groupId>-->
|
||||||
|
<!-- <artifactId>yudao-module-member-biz</artifactId>-->
|
||||||
|
<!-- <version>${revision}</version>-->
|
||||||
|
<!-- </dependency>-->
|
||||||
|
|
||||||
<!-- 数据报表。默认注释,保证编译速度 -->
|
<!-- 数据报表。默认注释,保证编译速度 -->
|
||||||
<!-- <dependency>-->
|
<!-- <dependency>-->
|
||||||
<!-- <groupId>cn.iocoder.boot</groupId>-->
|
<!-- <groupId>cn.iocoder.boot</groupId>-->
|
||||||
|
@ -34,8 +34,8 @@ spring:
|
|||||||
multi-statement-allow: true
|
multi-statement-allow: true
|
||||||
dynamic: # 多数据源配置
|
dynamic: # 多数据源配置
|
||||||
druid: # Druid 【连接池】相关的全局配置
|
druid: # Druid 【连接池】相关的全局配置
|
||||||
initial-size: 5 # 初始连接数
|
initial-size: 1 # 初始连接数
|
||||||
min-idle: 10 # 最小连接池数量
|
min-idle: 1 # 最小连接池数量
|
||||||
max-active: 20 # 最大连接池数量
|
max-active: 20 # 最大连接池数量
|
||||||
max-wait: 600000 # 配置获取连接等待超时的时间,单位:毫秒
|
max-wait: 600000 # 配置获取连接等待超时的时间,单位:毫秒
|
||||||
time-between-eviction-runs-millis: 60000 # 配置间隔多久才进行一次检测,检测需要关闭的空闲连接,单位:毫秒
|
time-between-eviction-runs-millis: 60000 # 配置间隔多久才进行一次检测,检测需要关闭的空闲连接,单位:毫秒
|
||||||
@ -60,6 +60,7 @@ spring:
|
|||||||
# password: JSm:g(*%lU4ZAkz06cd52KqT3)i1?H7W
|
# password: JSm:g(*%lU4ZAkz06cd52KqT3)i1?H7W
|
||||||
slave: # 模拟从库,可根据自己需要修改
|
slave: # 模拟从库,可根据自己需要修改
|
||||||
name: ruoyi-vue-pro
|
name: ruoyi-vue-pro
|
||||||
|
lazy: true # 开启懒加载,保证启动速度
|
||||||
url: jdbc:mysql://127.0.0.1:3306/${spring.datasource.dynamic.datasource.master.name}?useSSL=false&serverTimezone=Asia/Shanghai&allowPublicKeyRetrieval=true&nullCatalogMeansCurrent=true # MySQL Connector/J 8.X 连接的示例
|
url: jdbc:mysql://127.0.0.1:3306/${spring.datasource.dynamic.datasource.master.name}?useSSL=false&serverTimezone=Asia/Shanghai&allowPublicKeyRetrieval=true&nullCatalogMeansCurrent=true # MySQL Connector/J 8.X 连接的示例
|
||||||
# url: jdbc:mysql://127.0.0.1:3306/${spring.datasource.dynamic.datasource.slave.name}?useSSL=false&allowPublicKeyRetrieval=true&useUnicode=true&characterEncoding=UTF-8&serverTimezone=CTT # MySQL Connector/J 5.X 连接的示例
|
# url: jdbc:mysql://127.0.0.1:3306/${spring.datasource.dynamic.datasource.slave.name}?useSSL=false&allowPublicKeyRetrieval=true&useUnicode=true&characterEncoding=UTF-8&serverTimezone=CTT # MySQL Connector/J 5.X 连接的示例
|
||||||
# url: jdbc:postgresql://127.0.0.1:5432/${spring.datasource.dynamic.datasource.slave.name} # PostgreSQL 连接的示例
|
# url: jdbc:postgresql://127.0.0.1:5432/${spring.datasource.dynamic.datasource.slave.name} # PostgreSQL 连接的示例
|
||||||
|
@ -73,17 +73,20 @@ mybatis-plus:
|
|||||||
# id-type: ASSIGN_ID # 分配 ID,默认使用雪花算法。注意,Oracle、PostgreSQL、Kingbase、DB2、H2 数据库时,需要去除实体类上的 @KeySequence 注解
|
# id-type: ASSIGN_ID # 分配 ID,默认使用雪花算法。注意,Oracle、PostgreSQL、Kingbase、DB2、H2 数据库时,需要去除实体类上的 @KeySequence 注解
|
||||||
logic-delete-value: 1 # 逻辑已删除值(默认为 1)
|
logic-delete-value: 1 # 逻辑已删除值(默认为 1)
|
||||||
logic-not-delete-value: 0 # 逻辑未删除值(默认为 0)
|
logic-not-delete-value: 0 # 逻辑未删除值(默认为 0)
|
||||||
|
banner: false # 关闭控制台的 Banner 打印
|
||||||
type-aliases-package: ${yudao.info.base-package}.module.*.dal.dataobject
|
type-aliases-package: ${yudao.info.base-package}.module.*.dal.dataobject
|
||||||
encryptor:
|
encryptor:
|
||||||
password: XDV71a+xqStEA3WH # 加解密的秘钥,可使用 https://www.imaegoo.com/2020/aes-key-generator/ 网站生成
|
password: XDV71a+xqStEA3WH # 加解密的秘钥,可使用 https://www.imaegoo.com/2020/aes-key-generator/ 网站生成
|
||||||
|
|
||||||
|
mybatis-plus-join:
|
||||||
|
banner: false # 关闭控制台的 Banner 打印
|
||||||
|
|
||||||
# Spring Data Redis 配置
|
# Spring Data Redis 配置
|
||||||
spring:
|
spring:
|
||||||
data:
|
data:
|
||||||
redis:
|
redis:
|
||||||
repositories:
|
repositories:
|
||||||
enabled: false # 项目未使用到 Spring Data Redis 的 Repository,所以直接禁用,保证启动速度
|
enabled: false # 项目未使用到 Spring Data Redis 的 Repository,所以直接禁用,保证启动速度
|
||||||
|
|
||||||
--- #################### 验证码相关配置 ####################
|
--- #################### 验证码相关配置 ####################
|
||||||
|
|
||||||
aj:
|
aj:
|
||||||
|
Loading…
Reference in New Issue
Block a user