diff --git a/dpppt-backend-sdk/dpppt-backend-sdk-interops/pom.xml b/dpppt-backend-sdk/dpppt-backend-sdk-interops/pom.xml
index cf933d53..66188f02 100644
--- a/dpppt-backend-sdk/dpppt-backend-sdk-interops/pom.xml
+++ b/dpppt-backend-sdk/dpppt-backend-sdk-interops/pom.xml
@@ -71,6 +71,12 @@
spring-security-web
+
+ org.springframework.boot
+ spring-boot-starter-cloud-connectors
+ ${spring-cloud-connectors-version}
+
+
org.springframework.boot
diff --git a/dpppt-backend-sdk/dpppt-backend-sdk-interops/src/main/java/org/dpppt/backend/sdk/interops/config/WSCloudBaseConfig.java b/dpppt-backend-sdk/dpppt-backend-sdk-interops/src/main/java/org/dpppt/backend/sdk/interops/config/WSCloudBaseConfig.java
index 69f3b647..4e813de7 100644
--- a/dpppt-backend-sdk/dpppt-backend-sdk-interops/src/main/java/org/dpppt/backend/sdk/interops/config/WSCloudBaseConfig.java
+++ b/dpppt-backend-sdk/dpppt-backend-sdk-interops/src/main/java/org/dpppt/backend/sdk/interops/config/WSCloudBaseConfig.java
@@ -10,21 +10,40 @@
package org.dpppt.backend.sdk.interops.config;
+import java.util.Map;
import javax.sql.DataSource;
import org.flywaydb.core.Flyway;
-import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.beans.factory.annotation.Value;
+import org.springframework.cloud.CloudFactory;
+import org.springframework.cloud.service.PooledServiceConnectorConfig.PoolConfig;
+import org.springframework.cloud.service.relational.DataSourceConfig;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
-import org.springframework.context.annotation.Lazy;
@Configuration
public abstract class WSCloudBaseConfig extends WSBaseConfig {
- @Autowired @Lazy private DataSource dataSource;
+ @Value("${datasource.maximumPoolSize:5}")
+ int dataSourceMaximumPoolSize;
+ @Value("${datasource.connectionTimeout:30000}")
+ int dataSourceConnectionTimeout;
+
+ @Value("${datasource.leakDetectionThreshold:0}")
+ int dataSourceLeakDetectionThreshold;
+
+ @Bean
@Override
public DataSource dataSource() {
- return dataSource;
+ PoolConfig poolConfig = new PoolConfig(dataSourceMaximumPoolSize, dataSourceConnectionTimeout);
+ DataSourceConfig dbConfig =
+ new DataSourceConfig(
+ poolConfig,
+ null,
+ null,
+ Map.of("leakDetectionThreshold", dataSourceLeakDetectionThreshold));
+ CloudFactory factory = new CloudFactory();
+ return factory.getCloud().getSingletonServiceConnector(DataSource.class, dbConfig);
}
@Bean
diff --git a/dpppt-backend-sdk/dpppt-backend-sdk-ws/pom.xml b/dpppt-backend-sdk/dpppt-backend-sdk-ws/pom.xml
index 576be64d..3562cf66 100644
--- a/dpppt-backend-sdk/dpppt-backend-sdk-ws/pom.xml
+++ b/dpppt-backend-sdk/dpppt-backend-sdk-ws/pom.xml
@@ -35,7 +35,7 @@
org.springframework.boot
spring-boot-starter-cloud-connectors
- 2.0.7.RELEASE
+ ${spring-cloud-connectors-version}
diff --git a/dpppt-backend-sdk/pom.xml b/dpppt-backend-sdk/pom.xml
index 839d2cbb..b472dd9d 100644
--- a/dpppt-backend-sdk/pom.xml
+++ b/dpppt-backend-sdk/pom.xml
@@ -27,6 +27,7 @@
3.12.1
2.4.5
1.15.2
+ 2.0.7.RELEASE