I'm trying to create a new DataSource by importing the properties file as explain here and here.
I have created my dataSource.properties file and put it under the src/main/resources folder in my SpringBoot project.
Then I'll perform the following operations:
private static HikariConfig configA = null;
private static HikariDataSource dsA;
// Import properties from file
configA = new HikariConfig("path\\dataSource.properties");
configA.addDataSourceProperty("cachePrepStmts", "true");
configA.addDataSourceProperty("prepStmtCacheSize", "250");
configA.addDataSourceProperty("prepStmtCacheSqlLimit", "2048");
// Create the DataSource
dsA = new HikariDataSource(configA);
But when I try to get the values I'll always have null.
So I've tried to remove the dataSource. prefix from the dataSource.properties file, like this:
jdbcUrl=<url>
username=sa // username instead of user. This last one is not found
password=pwd
driverClassName=<driver>
poolName=poolA
maxLifetime=500000
maximumPoolSize=10
minimumIdle=5
leakDetectionThreshold=2100
connectionTimeout=30000
and magically the import works and I have my DataSource correctly configured.
Is it a normal behaviour? Or the documentation is wrong?
I'm using:
Spring Boot 2.7.17
HikariCP 4.0.3 (automatically imported with spring-boot-starter-data-jpa 2.7.17)
I'm trying to create a new DataSource by importing the properties file as explain here and here.
I have created my dataSource.properties file and put it under the src/main/resources folder in my SpringBoot project. Then I'll perform the following operations:
But when I try to get the values I'll always have null.
My dataSource.properties is like this:
So I've tried to remove the dataSource. prefix from the dataSource.properties file, like this:
and magically the import works and I have my DataSource correctly configured.
Is it a normal behaviour? Or the documentation is wrong?
I'm using: