diff --git a/backend/services/api-test/src/test/resources/application.properties b/backend/services/api-test/src/test/resources/application.properties index cf962fd88a..9f32f5fd46 100644 --- a/backend/services/api-test/src/test/resources/application.properties +++ b/backend/services/api-test/src/test/resources/application.properties @@ -25,7 +25,18 @@ spring.datasource.hikari.pool-name=DatebookHikariCP spring.datasource.hikari.max-lifetime=1800000 spring.datasource.hikari.connection-timeout=30000 spring.datasource.hikari.connection-test-query=SELECT 1 - +# quartz datasource +spring.datasource.quartz.url=${spring.datasource.url} +spring.datasource.quartz.username=${spring.datasource.username} +spring.datasource.quartz.password=${spring.datasource.password} +spring.datasource.quartz.hikari.maximum-pool-size=50 +spring.datasource.quartz.hikari.minimum-idle=10 +spring.datasource.quartz.hikari.idle-timeout=300000 +spring.datasource.quartz.hikari.auto-commit=true +spring.datasource.quartz.hikari.pool-name=DatebookHikariCP +spring.datasource.quartz.hikari.max-lifetime=1800000 +spring.datasource.quartz.hikari.connection-timeout=30000 +spring.datasource.quartz.hikari.connection-test-query=SELECT 1 # 单元测试初始化权限 sql spring.sql.init.mode=always spring.sql.init.schema-locations=classpath*:dml/init_permission_test.sql @@ -88,4 +99,4 @@ minio.secret-key=${embedded.minio.secretKey} logging.level.org.springframework.jdbc.core=info logging.level.io.metersphere.sdk.mapper=info -logging.level.io.metersphere.project.mapper=info \ No newline at end of file +logging.level.io.metersphere.project.mapper=info diff --git a/backend/services/bug-management/src/test/resources/application.properties b/backend/services/bug-management/src/test/resources/application.properties index d193f107b4..5a91a12e15 100644 --- a/backend/services/bug-management/src/test/resources/application.properties +++ b/backend/services/bug-management/src/test/resources/application.properties @@ -25,7 +25,18 @@ spring.datasource.hikari.pool-name=DatebookHikariCP spring.datasource.hikari.max-lifetime=1800000 spring.datasource.hikari.connection-timeout=30000 spring.datasource.hikari.connection-test-query=SELECT 1 - +# quartz datasource +spring.datasource.quartz.url=${spring.datasource.url} +spring.datasource.quartz.username=${spring.datasource.username} +spring.datasource.quartz.password=${spring.datasource.password} +spring.datasource.quartz.hikari.maximum-pool-size=50 +spring.datasource.quartz.hikari.minimum-idle=10 +spring.datasource.quartz.hikari.idle-timeout=300000 +spring.datasource.quartz.hikari.auto-commit=true +spring.datasource.quartz.hikari.pool-name=DatebookHikariCP +spring.datasource.quartz.hikari.max-lifetime=1800000 +spring.datasource.quartz.hikari.connection-timeout=30000 +spring.datasource.quartz.hikari.connection-test-query=SELECT 1 # 单元测试初始化权限 sql spring.sql.init.mode=always spring.sql.init.schema-locations=classpath*:dml/init_permission_test.sql diff --git a/backend/services/case-management/src/test/resources/application.properties b/backend/services/case-management/src/test/resources/application.properties index 67ebb1ea77..2bb88e6139 100644 --- a/backend/services/case-management/src/test/resources/application.properties +++ b/backend/services/case-management/src/test/resources/application.properties @@ -25,7 +25,18 @@ spring.datasource.hikari.pool-name=DatebookHikariCP spring.datasource.hikari.max-lifetime=1800000 spring.datasource.hikari.connection-timeout=30000 spring.datasource.hikari.connection-test-query=SELECT 1 - +# quartz datasource +spring.datasource.quartz.url=${spring.datasource.url} +spring.datasource.quartz.username=${spring.datasource.username} +spring.datasource.quartz.password=${spring.datasource.password} +spring.datasource.quartz.hikari.maximum-pool-size=50 +spring.datasource.quartz.hikari.minimum-idle=10 +spring.datasource.quartz.hikari.idle-timeout=300000 +spring.datasource.quartz.hikari.auto-commit=true +spring.datasource.quartz.hikari.pool-name=DatebookHikariCP +spring.datasource.quartz.hikari.max-lifetime=1800000 +spring.datasource.quartz.hikari.connection-timeout=30000 +spring.datasource.quartz.hikari.connection-test-query=SELECT 1 # # spring.kafka spring.kafka.bootstrap-servers=${embedded.kafka.brokerList} @@ -84,4 +95,4 @@ minio.secret-key=${embedded.minio.secretKey} logging.level.org.springframework.jdbc.core=info logging.level.io.metersphere.sdk.mapper=info -logging.level.io.metersphere.functional.mapper=info \ No newline at end of file +logging.level.io.metersphere.functional.mapper=info diff --git a/backend/services/project-management/src/test/resources/application.properties b/backend/services/project-management/src/test/resources/application.properties index 45771fff34..a24cc6149e 100644 --- a/backend/services/project-management/src/test/resources/application.properties +++ b/backend/services/project-management/src/test/resources/application.properties @@ -25,7 +25,18 @@ spring.datasource.hikari.pool-name=DatebookHikariCP spring.datasource.hikari.max-lifetime=1800000 spring.datasource.hikari.connection-timeout=30000 spring.datasource.hikari.connection-test-query=SELECT 1 - +# quartz datasource +spring.datasource.quartz.url=${spring.datasource.url} +spring.datasource.quartz.username=${spring.datasource.username} +spring.datasource.quartz.password=${spring.datasource.password} +spring.datasource.quartz.hikari.maximum-pool-size=50 +spring.datasource.quartz.hikari.minimum-idle=10 +spring.datasource.quartz.hikari.idle-timeout=300000 +spring.datasource.quartz.hikari.auto-commit=true +spring.datasource.quartz.hikari.pool-name=DatebookHikariCP +spring.datasource.quartz.hikari.max-lifetime=1800000 +spring.datasource.quartz.hikari.connection-timeout=30000 +spring.datasource.quartz.hikari.connection-test-query=SELECT 1 # 单元测试初始化权限 sql spring.sql.init.mode=always spring.sql.init.schema-locations=classpath*:dml/init_permission_test.sql @@ -85,4 +96,4 @@ minio.secret-key=${embedded.minio.secretKey} logging.level.org.springframework.jdbc.core=info logging.level.io.metersphere.sdk.mapper=info logging.level.io.metersphere.project.mapper=info -metersphere.file.batch-download-max=600MB \ No newline at end of file +metersphere.file.batch-download-max=600MB diff --git a/backend/services/system-setting/src/main/java/io/metersphere/system/config/MybatisConfig.java b/backend/services/system-setting/src/main/java/io/metersphere/system/config/MybatisConfig.java index b0dc1715e8..d07a216d75 100644 --- a/backend/services/system-setting/src/main/java/io/metersphere/system/config/MybatisConfig.java +++ b/backend/services/system-setting/src/main/java/io/metersphere/system/config/MybatisConfig.java @@ -7,6 +7,7 @@ import io.metersphere.system.interceptor.MybatisInterceptor; import io.metersphere.system.interceptor.UserDesensitizationInterceptor; import io.metersphere.system.utils.MybatisInterceptorConfig; import org.mybatis.spring.annotation.MapperScan; +import org.springframework.beans.factory.annotation.Qualifier; import org.springframework.boot.autoconfigure.jdbc.DataSourceProperties; import org.springframework.boot.context.properties.ConfigurationProperties; import org.springframework.boot.jdbc.DataSourceBuilder; @@ -58,7 +59,7 @@ public class MybatisConfig { @Bean @Primary @ConfigurationProperties(prefix = "spring.datasource.hikari") - public DataSource dataSource(DataSourceProperties properties) { + public DataSource dataSource(@Qualifier("dataSourceProperties") DataSourceProperties properties) { return DataSourceBuilder.create(properties.getClassLoader()).type(HikariDataSource.class) .driverClassName(properties.determineDriverClassName()) .url(properties.determineUrl()) @@ -70,7 +71,7 @@ public class MybatisConfig { @Bean @ConfigurationProperties(prefix = "spring.datasource.quartz.hikari") @QuartzDataSource - public DataSource quartzDataSource(DataSourceProperties properties) { + public DataSource quartzDataSource(@Qualifier("quartzDataSourceProperties") DataSourceProperties properties) { return DataSourceBuilder.create(properties.getClassLoader()).type(HikariDataSource.class) .driverClassName(properties.determineDriverClassName()) .url(properties.determineUrl()) @@ -79,4 +80,16 @@ public class MybatisConfig { .build(); } + @Bean("dataSourceProperties") + @Primary + @ConfigurationProperties(prefix = "spring.datasource") + public DataSourceProperties dataSourceProperties() { + return new DataSourceProperties(); + } + + @Bean("quartzDataSourceProperties") + @ConfigurationProperties(prefix = "spring.datasource.quartz") + public DataSourceProperties quartzDataSourceProperties() { + return new DataSourceProperties(); + } } diff --git a/backend/services/system-setting/src/test/resources/application.properties b/backend/services/system-setting/src/test/resources/application.properties index 45ed0b2d82..88ca3d9777 100644 --- a/backend/services/system-setting/src/test/resources/application.properties +++ b/backend/services/system-setting/src/test/resources/application.properties @@ -25,7 +25,18 @@ spring.datasource.hikari.pool-name=DatebookHikariCP spring.datasource.hikari.max-lifetime=1800000 spring.datasource.hikari.connection-timeout=30000 spring.datasource.hikari.connection-test-query=SELECT 1 - +# quartz datasource +spring.datasource.quartz.url=${spring.datasource.url} +spring.datasource.quartz.username=${spring.datasource.username} +spring.datasource.quartz.password=${spring.datasource.password} +spring.datasource.quartz.hikari.maximum-pool-size=50 +spring.datasource.quartz.hikari.minimum-idle=10 +spring.datasource.quartz.hikari.idle-timeout=300000 +spring.datasource.quartz.hikari.auto-commit=true +spring.datasource.quartz.hikari.pool-name=DatebookHikariCP +spring.datasource.quartz.hikari.max-lifetime=1800000 +spring.datasource.quartz.hikari.connection-timeout=30000 +spring.datasource.quartz.hikari.connection-test-query=SELECT 1 # 单元测试初始化权限 sql spring.sql.init.mode=always spring.sql.init.schema-locations=classpath*:dml/init_permission_test.sql @@ -84,4 +95,4 @@ minio.secret-key=${embedded.minio.secretKey} logging.level.org.springframework.jdbc.core=info logging.level.io.metersphere.sdk.mapper=info -logging.level.io.metersphere.system.mapper=info \ No newline at end of file +logging.level.io.metersphere.system.mapper=info diff --git a/backend/services/test-plan/src/test/resources/application.properties b/backend/services/test-plan/src/test/resources/application.properties index 664e5fab2d..2ecda9c671 100644 --- a/backend/services/test-plan/src/test/resources/application.properties +++ b/backend/services/test-plan/src/test/resources/application.properties @@ -25,6 +25,18 @@ spring.datasource.hikari.pool-name=DatebookHikariCP spring.datasource.hikari.max-lifetime=1800000 spring.datasource.hikari.connection-timeout=30000 spring.datasource.hikari.connection-test-query=SELECT 1 +# quartz datasource +spring.datasource.quartz.url=${spring.datasource.url} +spring.datasource.quartz.username=${spring.datasource.username} +spring.datasource.quartz.password=${spring.datasource.password} +spring.datasource.quartz.hikari.maximum-pool-size=50 +spring.datasource.quartz.hikari.minimum-idle=10 +spring.datasource.quartz.hikari.idle-timeout=300000 +spring.datasource.quartz.hikari.auto-commit=true +spring.datasource.quartz.hikari.pool-name=DatebookHikariCP +spring.datasource.quartz.hikari.max-lifetime=1800000 +spring.datasource.quartz.hikari.connection-timeout=30000 +spring.datasource.quartz.hikari.connection-test-query=SELECT 1 # 单元测试初始化权限 sql spring.sql.init.mode=always spring.sql.init.schema-locations=classpath*:dml/init_permission_test.sql @@ -84,4 +96,4 @@ logging.level.org.springframework.jdbc.core=info logging.level.io.metersphere.sdk.mapper=info logging.level.io.metersphere.system.mapper=info logging.level.io.metersphere.plan.mapper=info -metersphere.file.batch-download-max=600MB \ No newline at end of file +metersphere.file.batch-download-max=600MB