From 58309c5aafe4fc29d0fbda65f4d034ff950cce9f Mon Sep 17 00:00:00 2001 From: DonaldChung-HK <37064034+DonaldChung-HK@users.noreply.github.com> Date: Mon, 9 Dec 2024 14:43:28 +0000 Subject: [PATCH] fix datasource configuration to avoid too many hikari connection --- .../main/java/it/infn/mw/iam/config/DataSourceConfig.java | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/iam-login-service/src/main/java/it/infn/mw/iam/config/DataSourceConfig.java b/iam-login-service/src/main/java/it/infn/mw/iam/config/DataSourceConfig.java index b78857963..d66aa1852 100644 --- a/iam-login-service/src/main/java/it/infn/mw/iam/config/DataSourceConfig.java +++ b/iam-login-service/src/main/java/it/infn/mw/iam/config/DataSourceConfig.java @@ -15,6 +15,8 @@ */ package it.infn.mw.iam.config; +import javax.sql.DataSource; + import org.springframework.beans.factory.annotation.Qualifier; import org.springframework.boot.autoconfigure.condition.ConditionalOnProperty; import org.springframework.boot.autoconfigure.jdbc.DataSourceProperties; @@ -38,7 +40,7 @@ public DataSourceProperties dataSourceProperties() { @Bean @Primary - public HikariDataSource primaryDataSource(@Qualifier("dataSource") DataSourceProperties dataSourceProperties) { + public DataSource primaryDataSource(@Qualifier("dataSource") DataSourceProperties dataSourceProperties) { return dataSourceProperties .initializeDataSourceBuilder() .type(HikariDataSource.class) @@ -56,7 +58,7 @@ public DataSourceProperties sessionDataSourceProperties() { @Qualifier("sessionDataSource") @SpringSessionDataSource @ConditionalOnProperty(name = "spring.session.store-type", havingValue = "jdbc") - public HikariDataSource sessionDataSource(@Qualifier("sessionDataSourceProperties") DataSourceProperties sessionDataSourceProperties) { + public DataSource sessionDataSource(@Qualifier("sessionDataSourceProperties") DataSourceProperties sessionDataSourceProperties) { return sessionDataSourceProperties .initializeDataSourceBuilder() .type(HikariDataSource.class)