fix: 禁用spring默认的datasource,强制使用系统内自定义的datasource
This commit is contained in:
parent
30a537c376
commit
606a67be81
|
@ -5,6 +5,7 @@ import io.metersphere.config.KafkaProperties;
|
||||||
import io.metersphere.config.MinioProperties;
|
import io.metersphere.config.MinioProperties;
|
||||||
import org.springframework.boot.SpringApplication;
|
import org.springframework.boot.SpringApplication;
|
||||||
import org.springframework.boot.autoconfigure.SpringBootApplication;
|
import org.springframework.boot.autoconfigure.SpringBootApplication;
|
||||||
|
import org.springframework.boot.autoconfigure.jdbc.DataSourceAutoConfiguration;
|
||||||
import org.springframework.boot.autoconfigure.ldap.LdapAutoConfiguration;
|
import org.springframework.boot.autoconfigure.ldap.LdapAutoConfiguration;
|
||||||
import org.springframework.boot.autoconfigure.neo4j.Neo4jAutoConfiguration;
|
import org.springframework.boot.autoconfigure.neo4j.Neo4jAutoConfiguration;
|
||||||
import org.springframework.boot.autoconfigure.quartz.QuartzAutoConfiguration;
|
import org.springframework.boot.autoconfigure.quartz.QuartzAutoConfiguration;
|
||||||
|
@ -13,6 +14,7 @@ import org.springframework.boot.web.servlet.ServletComponentScan;
|
||||||
import org.springframework.context.annotation.PropertySource;
|
import org.springframework.context.annotation.PropertySource;
|
||||||
|
|
||||||
@SpringBootApplication(exclude = {
|
@SpringBootApplication(exclude = {
|
||||||
|
DataSourceAutoConfiguration.class,
|
||||||
QuartzAutoConfiguration.class,
|
QuartzAutoConfiguration.class,
|
||||||
LdapAutoConfiguration.class,
|
LdapAutoConfiguration.class,
|
||||||
Neo4jAutoConfiguration.class
|
Neo4jAutoConfiguration.class
|
||||||
|
|
|
@ -63,7 +63,6 @@ public class CommonsDatabaseConfig {
|
||||||
@Bean
|
@Bean
|
||||||
@Primary
|
@Primary
|
||||||
@ConfigurationProperties(prefix = "spring.datasource.hikari")
|
@ConfigurationProperties(prefix = "spring.datasource.hikari")
|
||||||
@ConditionalOnMissingBean
|
|
||||||
public DataSource dataSource(DataSourceProperties properties) {
|
public DataSource dataSource(DataSourceProperties properties) {
|
||||||
return DataSourceBuilder.create(properties.getClassLoader()).type(HikariDataSource.class)
|
return DataSourceBuilder.create(properties.getClassLoader()).type(HikariDataSource.class)
|
||||||
.driverClassName(properties.determineDriverClassName())
|
.driverClassName(properties.determineDriverClassName())
|
||||||
|
@ -76,7 +75,6 @@ public class CommonsDatabaseConfig {
|
||||||
@Bean
|
@Bean
|
||||||
@ConfigurationProperties(prefix = "spring.datasource.quartz.hikari")
|
@ConfigurationProperties(prefix = "spring.datasource.quartz.hikari")
|
||||||
@QuartzDataSource
|
@QuartzDataSource
|
||||||
@ConditionalOnMissingBean
|
|
||||||
@ConditionalOnProperty(prefix = "quartz", value = "enabled", havingValue = "true")
|
@ConditionalOnProperty(prefix = "quartz", value = "enabled", havingValue = "true")
|
||||||
public DataSource quartzDataSource(DataSourceProperties properties) {
|
public DataSource quartzDataSource(DataSourceProperties properties) {
|
||||||
return DataSourceBuilder.create(properties.getClassLoader()).type(HikariDataSource.class)
|
return DataSourceBuilder.create(properties.getClassLoader()).type(HikariDataSource.class)
|
||||||
|
|
|
@ -1,8 +1,9 @@
|
||||||
# Hikari
|
# Hikari
|
||||||
spring.datasource.type=com.zaxxer.hikari.HikariDataSource
|
spring.datasource.type=com.zaxxer.hikari.HikariDataSource
|
||||||
spring.datasource.hikari.maximum-pool-size=10
|
spring.datasource.hikari.maximum-pool-size=20
|
||||||
|
spring.datasource.hikari.minimum-idle=10
|
||||||
|
spring.datasource.hikari.idle-timeout=600000
|
||||||
spring.datasource.hikari.auto-commit=true
|
spring.datasource.hikari.auto-commit=true
|
||||||
spring.datasource.hikari.idle-timeout=10000
|
|
||||||
spring.datasource.hikari.pool-name=DatebookHikariCP
|
spring.datasource.hikari.pool-name=DatebookHikariCP
|
||||||
spring.datasource.hikari.max-lifetime=1800000
|
spring.datasource.hikari.max-lifetime=1800000
|
||||||
spring.datasource.hikari.connection-timeout=30000
|
spring.datasource.hikari.connection-timeout=30000
|
||||||
|
@ -11,9 +12,10 @@ spring.datasource.hikari.connection-test-query=SELECT 1
|
||||||
spring.datasource.quartz.url=${spring.datasource.url}
|
spring.datasource.quartz.url=${spring.datasource.url}
|
||||||
spring.datasource.quartz.username=${spring.datasource.username}
|
spring.datasource.quartz.username=${spring.datasource.username}
|
||||||
spring.datasource.quartz.password=${spring.datasource.password}
|
spring.datasource.quartz.password=${spring.datasource.password}
|
||||||
spring.datasource.quartz.hikari.maximum-pool-size=10
|
spring.datasource.quartz.hikari.maximum-pool-size=20
|
||||||
|
spring.datasource.quartz.hikari.minimum-idle=10
|
||||||
|
spring.datasource.quartz.hikari.idle-timeout=600000
|
||||||
spring.datasource.quartz.hikari.auto-commit=true
|
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.pool-name=DatebookHikariCP
|
||||||
spring.datasource.quartz.hikari.max-lifetime=1800000
|
spring.datasource.quartz.hikari.max-lifetime=1800000
|
||||||
spring.datasource.quartz.hikari.connection-timeout=30000
|
spring.datasource.quartz.hikari.connection-timeout=30000
|
||||||
|
|
|
@ -5,6 +5,7 @@ import io.metersphere.config.KafkaProperties;
|
||||||
import io.metersphere.config.MinioProperties;
|
import io.metersphere.config.MinioProperties;
|
||||||
import org.springframework.boot.SpringApplication;
|
import org.springframework.boot.SpringApplication;
|
||||||
import org.springframework.boot.autoconfigure.SpringBootApplication;
|
import org.springframework.boot.autoconfigure.SpringBootApplication;
|
||||||
|
import org.springframework.boot.autoconfigure.jdbc.DataSourceAutoConfiguration;
|
||||||
import org.springframework.boot.autoconfigure.ldap.LdapAutoConfiguration;
|
import org.springframework.boot.autoconfigure.ldap.LdapAutoConfiguration;
|
||||||
import org.springframework.boot.autoconfigure.neo4j.Neo4jAutoConfiguration;
|
import org.springframework.boot.autoconfigure.neo4j.Neo4jAutoConfiguration;
|
||||||
import org.springframework.boot.autoconfigure.quartz.QuartzAutoConfiguration;
|
import org.springframework.boot.autoconfigure.quartz.QuartzAutoConfiguration;
|
||||||
|
@ -13,6 +14,7 @@ import org.springframework.boot.web.servlet.ServletComponentScan;
|
||||||
import org.springframework.context.annotation.PropertySource;
|
import org.springframework.context.annotation.PropertySource;
|
||||||
|
|
||||||
@SpringBootApplication(exclude = {
|
@SpringBootApplication(exclude = {
|
||||||
|
DataSourceAutoConfiguration.class,
|
||||||
QuartzAutoConfiguration.class,
|
QuartzAutoConfiguration.class,
|
||||||
LdapAutoConfiguration.class,
|
LdapAutoConfiguration.class,
|
||||||
Neo4jAutoConfiguration.class
|
Neo4jAutoConfiguration.class
|
||||||
|
|
|
@ -3,6 +3,7 @@ package io.metersphere;
|
||||||
import io.metersphere.config.MinioProperties;
|
import io.metersphere.config.MinioProperties;
|
||||||
import org.springframework.boot.SpringApplication;
|
import org.springframework.boot.SpringApplication;
|
||||||
import org.springframework.boot.autoconfigure.SpringBootApplication;
|
import org.springframework.boot.autoconfigure.SpringBootApplication;
|
||||||
|
import org.springframework.boot.autoconfigure.jdbc.DataSourceAutoConfiguration;
|
||||||
import org.springframework.boot.autoconfigure.ldap.LdapAutoConfiguration;
|
import org.springframework.boot.autoconfigure.ldap.LdapAutoConfiguration;
|
||||||
import org.springframework.boot.autoconfigure.neo4j.Neo4jAutoConfiguration;
|
import org.springframework.boot.autoconfigure.neo4j.Neo4jAutoConfiguration;
|
||||||
import org.springframework.boot.autoconfigure.quartz.QuartzAutoConfiguration;
|
import org.springframework.boot.autoconfigure.quartz.QuartzAutoConfiguration;
|
||||||
|
@ -11,6 +12,7 @@ import org.springframework.boot.web.servlet.ServletComponentScan;
|
||||||
import org.springframework.context.annotation.PropertySource;
|
import org.springframework.context.annotation.PropertySource;
|
||||||
|
|
||||||
@SpringBootApplication(exclude = {
|
@SpringBootApplication(exclude = {
|
||||||
|
DataSourceAutoConfiguration.class,
|
||||||
QuartzAutoConfiguration.class,
|
QuartzAutoConfiguration.class,
|
||||||
LdapAutoConfiguration.class,
|
LdapAutoConfiguration.class,
|
||||||
Neo4jAutoConfiguration.class
|
Neo4jAutoConfiguration.class
|
||||||
|
|
|
@ -5,6 +5,7 @@ import io.metersphere.config.KafkaProperties;
|
||||||
import io.metersphere.config.MinioProperties;
|
import io.metersphere.config.MinioProperties;
|
||||||
import org.springframework.boot.SpringApplication;
|
import org.springframework.boot.SpringApplication;
|
||||||
import org.springframework.boot.autoconfigure.SpringBootApplication;
|
import org.springframework.boot.autoconfigure.SpringBootApplication;
|
||||||
|
import org.springframework.boot.autoconfigure.jdbc.DataSourceAutoConfiguration;
|
||||||
import org.springframework.boot.autoconfigure.ldap.LdapAutoConfiguration;
|
import org.springframework.boot.autoconfigure.ldap.LdapAutoConfiguration;
|
||||||
import org.springframework.boot.autoconfigure.neo4j.Neo4jAutoConfiguration;
|
import org.springframework.boot.autoconfigure.neo4j.Neo4jAutoConfiguration;
|
||||||
import org.springframework.boot.autoconfigure.quartz.QuartzAutoConfiguration;
|
import org.springframework.boot.autoconfigure.quartz.QuartzAutoConfiguration;
|
||||||
|
@ -13,6 +14,7 @@ import org.springframework.boot.web.servlet.ServletComponentScan;
|
||||||
import org.springframework.context.annotation.PropertySource;
|
import org.springframework.context.annotation.PropertySource;
|
||||||
|
|
||||||
@SpringBootApplication(exclude = {
|
@SpringBootApplication(exclude = {
|
||||||
|
DataSourceAutoConfiguration.class,
|
||||||
QuartzAutoConfiguration.class,
|
QuartzAutoConfiguration.class,
|
||||||
LdapAutoConfiguration.class,
|
LdapAutoConfiguration.class,
|
||||||
Neo4jAutoConfiguration.class
|
Neo4jAutoConfiguration.class
|
||||||
|
|
|
@ -3,6 +3,7 @@ package io.metersphere;
|
||||||
import io.metersphere.config.MinioProperties;
|
import io.metersphere.config.MinioProperties;
|
||||||
import org.springframework.boot.SpringApplication;
|
import org.springframework.boot.SpringApplication;
|
||||||
import org.springframework.boot.autoconfigure.SpringBootApplication;
|
import org.springframework.boot.autoconfigure.SpringBootApplication;
|
||||||
|
import org.springframework.boot.autoconfigure.jdbc.DataSourceAutoConfiguration;
|
||||||
import org.springframework.boot.autoconfigure.ldap.LdapAutoConfiguration;
|
import org.springframework.boot.autoconfigure.ldap.LdapAutoConfiguration;
|
||||||
import org.springframework.boot.autoconfigure.neo4j.Neo4jAutoConfiguration;
|
import org.springframework.boot.autoconfigure.neo4j.Neo4jAutoConfiguration;
|
||||||
import org.springframework.boot.autoconfigure.quartz.QuartzAutoConfiguration;
|
import org.springframework.boot.autoconfigure.quartz.QuartzAutoConfiguration;
|
||||||
|
@ -11,6 +12,7 @@ import org.springframework.boot.web.servlet.ServletComponentScan;
|
||||||
import org.springframework.context.annotation.PropertySource;
|
import org.springframework.context.annotation.PropertySource;
|
||||||
|
|
||||||
@SpringBootApplication(exclude = {
|
@SpringBootApplication(exclude = {
|
||||||
|
DataSourceAutoConfiguration.class,
|
||||||
QuartzAutoConfiguration.class,
|
QuartzAutoConfiguration.class,
|
||||||
LdapAutoConfiguration.class,
|
LdapAutoConfiguration.class,
|
||||||
Neo4jAutoConfiguration.class
|
Neo4jAutoConfiguration.class
|
||||||
|
|
|
@ -5,6 +5,7 @@ import io.metersphere.config.KafkaProperties;
|
||||||
import io.metersphere.config.MinioProperties;
|
import io.metersphere.config.MinioProperties;
|
||||||
import org.springframework.boot.SpringApplication;
|
import org.springframework.boot.SpringApplication;
|
||||||
import org.springframework.boot.autoconfigure.SpringBootApplication;
|
import org.springframework.boot.autoconfigure.SpringBootApplication;
|
||||||
|
import org.springframework.boot.autoconfigure.jdbc.DataSourceAutoConfiguration;
|
||||||
import org.springframework.boot.autoconfigure.ldap.LdapAutoConfiguration;
|
import org.springframework.boot.autoconfigure.ldap.LdapAutoConfiguration;
|
||||||
import org.springframework.boot.autoconfigure.neo4j.Neo4jAutoConfiguration;
|
import org.springframework.boot.autoconfigure.neo4j.Neo4jAutoConfiguration;
|
||||||
import org.springframework.boot.autoconfigure.quartz.QuartzAutoConfiguration;
|
import org.springframework.boot.autoconfigure.quartz.QuartzAutoConfiguration;
|
||||||
|
@ -13,6 +14,7 @@ import org.springframework.boot.web.servlet.ServletComponentScan;
|
||||||
import org.springframework.context.annotation.PropertySource;
|
import org.springframework.context.annotation.PropertySource;
|
||||||
|
|
||||||
@SpringBootApplication(exclude = {
|
@SpringBootApplication(exclude = {
|
||||||
|
DataSourceAutoConfiguration.class,
|
||||||
QuartzAutoConfiguration.class,
|
QuartzAutoConfiguration.class,
|
||||||
LdapAutoConfiguration.class,
|
LdapAutoConfiguration.class,
|
||||||
Neo4jAutoConfiguration.class
|
Neo4jAutoConfiguration.class
|
||||||
|
|
|
@ -5,6 +5,7 @@ import io.metersphere.config.KafkaProperties;
|
||||||
import io.metersphere.config.MinioProperties;
|
import io.metersphere.config.MinioProperties;
|
||||||
import org.springframework.boot.SpringApplication;
|
import org.springframework.boot.SpringApplication;
|
||||||
import org.springframework.boot.autoconfigure.SpringBootApplication;
|
import org.springframework.boot.autoconfigure.SpringBootApplication;
|
||||||
|
import org.springframework.boot.autoconfigure.jdbc.DataSourceAutoConfiguration;
|
||||||
import org.springframework.boot.autoconfigure.ldap.LdapAutoConfiguration;
|
import org.springframework.boot.autoconfigure.ldap.LdapAutoConfiguration;
|
||||||
import org.springframework.boot.autoconfigure.neo4j.Neo4jAutoConfiguration;
|
import org.springframework.boot.autoconfigure.neo4j.Neo4jAutoConfiguration;
|
||||||
import org.springframework.boot.autoconfigure.quartz.QuartzAutoConfiguration;
|
import org.springframework.boot.autoconfigure.quartz.QuartzAutoConfiguration;
|
||||||
|
@ -13,6 +14,7 @@ import org.springframework.boot.web.servlet.ServletComponentScan;
|
||||||
import org.springframework.context.annotation.PropertySource;
|
import org.springframework.context.annotation.PropertySource;
|
||||||
|
|
||||||
@SpringBootApplication(exclude = {
|
@SpringBootApplication(exclude = {
|
||||||
|
DataSourceAutoConfiguration.class,
|
||||||
QuartzAutoConfiguration.class,
|
QuartzAutoConfiguration.class,
|
||||||
LdapAutoConfiguration.class,
|
LdapAutoConfiguration.class,
|
||||||
Neo4jAutoConfiguration.class
|
Neo4jAutoConfiguration.class
|
||||||
|
|
Loading…
Reference in New Issue