|
|
@@ -3,6 +3,7 @@ package com.etotem.cfc.config;
|
|
|
import com.zaxxer.hikari.HikariConfig;
|
|
|
import com.zaxxer.hikari.HikariDataSource;
|
|
|
import org.springframework.beans.factory.annotation.Value;
|
|
|
+import org.springframework.boot.autoconfigure.condition.ConditionalOnProperty;
|
|
|
import org.springframework.context.annotation.Bean;
|
|
|
import org.springframework.context.annotation.Configuration;
|
|
|
import org.springframework.context.annotation.Primary;
|
|
|
@@ -70,6 +71,7 @@ public class SfmsDataSourceConfig {
|
|
|
private String sfmsDriverClassName;
|
|
|
|
|
|
@Bean(name = "sfmsDataSource")
|
|
|
+ @ConditionalOnProperty(name = "sfms.datasource.enabled", havingValue = "true", matchIfMissing = false)
|
|
|
public DataSource sfmsDataSource() {
|
|
|
HikariConfig config = new HikariConfig();
|
|
|
config.setJdbcUrl(sfmsUrl);
|
|
|
@@ -88,6 +90,7 @@ public class SfmsDataSourceConfig {
|
|
|
}
|
|
|
|
|
|
@Bean
|
|
|
+ @ConditionalOnProperty(name = "sfms.datasource.enabled", havingValue = "true", matchIfMissing = false)
|
|
|
public JdbcTemplate sfmsJdbcTemplate() {
|
|
|
return new JdbcTemplate(sfmsDataSource());
|
|
|
}
|