parent
d4efd9d76d
commit
94cb12a24b
|
@ -1,6 +1,8 @@
|
|||
package io.metersphere.config;
|
||||
|
||||
import com.fit2cloud.quartz.anno.QuartzDataSource;
|
||||
import com.github.pagehelper.PageInterceptor;
|
||||
import com.zaxxer.hikari.HikariDataSource;
|
||||
import io.metersphere.base.domain.ApiTestReportDetail;
|
||||
import io.metersphere.base.domain.AuthSource;
|
||||
import io.metersphere.base.domain.FileContent;
|
||||
|
@ -11,10 +13,15 @@ import io.metersphere.interceptor.MybatisInterceptor;
|
|||
import io.metersphere.interceptor.UserDesensitizationInterceptor;
|
||||
import org.mybatis.spring.annotation.MapperScan;
|
||||
import org.springframework.boot.autoconfigure.condition.ConditionalOnMissingBean;
|
||||
import org.springframework.boot.autoconfigure.jdbc.DataSourceProperties;
|
||||
import org.springframework.boot.context.properties.ConfigurationProperties;
|
||||
import org.springframework.boot.jdbc.DataSourceBuilder;
|
||||
import org.springframework.context.annotation.Bean;
|
||||
import org.springframework.context.annotation.Configuration;
|
||||
import org.springframework.context.annotation.Primary;
|
||||
import org.springframework.transaction.annotation.EnableTransactionManagement;
|
||||
|
||||
import javax.sql.DataSource;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
import java.util.Properties;
|
||||
|
@ -22,7 +29,7 @@ import java.util.Properties;
|
|||
@Configuration
|
||||
@MapperScan(basePackages = {"io.metersphere.base.mapper", "io.metersphere.xpack.mapper"}, sqlSessionFactoryRef = "sqlSessionFactory")
|
||||
@EnableTransactionManagement
|
||||
public class MybatisConfig {
|
||||
public class DatabaseConfig {
|
||||
|
||||
@Bean
|
||||
@ConditionalOnMissingBean
|
||||
|
@ -55,4 +62,30 @@ public class MybatisConfig {
|
|||
public UserDesensitizationInterceptor userDesensitizationInterceptor() {
|
||||
return new UserDesensitizationInterceptor();
|
||||
}
|
||||
|
||||
@Bean
|
||||
@Primary
|
||||
@ConfigurationProperties(prefix = "spring.datasource.hikari")
|
||||
public DataSource dataSource(DataSourceProperties properties) {
|
||||
return DataSourceBuilder.create(properties.getClassLoader()).type(HikariDataSource.class)
|
||||
.driverClassName(properties.determineDriverClassName())
|
||||
.url(properties.determineUrl())
|
||||
.username(properties.determineUsername())
|
||||
.password(properties.determinePassword())
|
||||
.build();
|
||||
}
|
||||
|
||||
@Bean
|
||||
@ConfigurationProperties(prefix = "spring.datasource.quartz.hikari")
|
||||
@QuartzDataSource
|
||||
public DataSource quartzDataSource(DataSourceProperties properties) {
|
||||
return DataSourceBuilder.create(properties.getClassLoader()).type(HikariDataSource.class)
|
||||
.driverClassName(properties.determineDriverClassName())
|
||||
.url(properties.determineUrl())
|
||||
.username(properties.determineUsername())
|
||||
.password(properties.determinePassword())
|
||||
.build();
|
||||
}
|
||||
|
||||
|
||||
}
|
|
@ -11,6 +11,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
|
||||
#
|
||||
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.auto-commit=true
|
||||
spring.datasource.quartz.hikari.idle-timeout=10000
|
||||
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
|
||||
#
|
||||
#kafka
|
||||
spring.kafka.bootstrap-servers=${kafka.bootstrap-servers}
|
||||
spring.kafka.consumer.group-id=metersphere_group_id
|
||||
|
@ -71,6 +83,7 @@ jmeter.home=/opt/jmeter
|
|||
# quartz
|
||||
quartz.enabled=true
|
||||
quartz.scheduler-name=msServerJob
|
||||
quartz.thread-count=30
|
||||
# file upload
|
||||
spring.servlet.multipart.max-file-size=500MB
|
||||
spring.servlet.multipart.max-request-size=500MB
|
||||
|
|
Loading…
Reference in New Issue