Skip to content
Snippets Groups Projects
Commit e2fdbb4a authored by Sascha Herzinger's avatar Sascha Herzinger
Browse files

Reverting to C3P0 for now because of logging issues

parent 6f4b0c54
No related branches found
No related tags found
2 merge requests!630WIP: Resolve "The privileges of a new user are not saved in some cases",!499Spring config update
Pipeline #7327 failed
......@@ -147,10 +147,15 @@
<version>${postgresql-jdbc.version}</version>
</dependency>
<dependency>
<groupId>com.zaxxer</groupId>
<artifactId>HikariCP</artifactId>
<version>${hikari.version}</version>
<!--<dependency>-->
<!--<groupId>com.zaxxer</groupId>-->
<!--<artifactId>HikariCP</artifactId>-->
<!--<version>${hikari.version}</version>-->
<!--</dependency>-->
<dependency>
<groupId>c3p0</groupId>
<artifactId>c3p0</artifactId>
<version>${c3p0.version}</version>
</dependency>
<dependency>
......
package lcsb.mapviewer.persist;
import com.zaxxer.hikari.HikariDataSource;
import com.mchange.v2.c3p0.ComboPooledDataSource;
import org.hibernate.SessionFactory;
import org.hibernate.cfg.Environment;
import org.springframework.boot.orm.jpa.hibernate.SpringPhysicalNamingStrategy;
......@@ -15,6 +15,7 @@ import org.springframework.security.authentication.encoding.Md5PasswordEncoder;
import org.springframework.transaction.annotation.EnableTransactionManagement;
import javax.sql.DataSource;
import java.beans.PropertyVetoException;
import java.util.Properties;
@Configuration
......@@ -27,15 +28,29 @@ public class SpringPersistConfig {
return new ConfigurationHolder();
}
@Bean
public HikariDataSource dataSource(ConfigurationHolder config) {
HikariDataSource dataSource = new HikariDataSource();
dataSource.setDriverClassName("org.postgresql.Driver");
// @Bean
// public HikariDataSource dataSource(ConfigurationHolder config) {
// HikariDataSource dataSource = new HikariDataSource();
// dataSource.setDriverClassName("org.postgresql.Driver");
// dataSource.setJdbcUrl(config.getDbUri());
// dataSource.setUsername(config.getDbUsername());
// dataSource.setPassword(config.getDbPassword());
// dataSource.setIdleTimeout(30000);
// dataSource.setMaximumPoolSize(90);
// dataSource.setConnectionTestQuery("select 1");
// return dataSource;
// }
@Bean(destroyMethod = "close")
public ComboPooledDataSource dataSource(ConfigurationHolder config) throws PropertyVetoException {
ComboPooledDataSource dataSource = new ComboPooledDataSource();
dataSource.setDriverClass("org.postgresql.Driver");
dataSource.setJdbcUrl(config.getDbUri());
dataSource.setUsername(config.getDbUsername());
dataSource.setUser(config.getDbUsername());
dataSource.setPassword(config.getDbPassword());
dataSource.setIdleTimeout(30000);
dataSource.setMaximumPoolSize(90);
dataSource.setMinPoolSize(5);
dataSource.setMaxPoolSize(90);
dataSource.setMaxStatements(5);
return dataSource;
}
......
......@@ -65,6 +65,7 @@
<postgresql-jdbc.version>42.2.5</postgresql-jdbc.version>
<hikari.version>3.2.0</hikari.version>
<c3p0.version>0.9.1.2</c3p0.version>
<cglib.version>3.2.8</cglib.version>
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment