Skip to content

Commit

Permalink
fix datasource configuration to avoid too many hikari connection
Browse files Browse the repository at this point in the history
  • Loading branch information
DonaldChung-HK committed Dec 9, 2024
1 parent 8a7bb09 commit 58309c5
Showing 1 changed file with 4 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand All @@ -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)
Expand All @@ -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)
Expand Down

0 comments on commit 58309c5

Please sign in to comment.