We have MYSQL for production and i am doing ( well trying to ) add h2 for Testing the Database .... here there is the problem .
I am adding an application.properties
under src/test/resources
and the default is as usually under src/java/resources
The problem is the way application.properties
under src/java/resources
is congifured to use MYSQL like :
spring.datasource.driverClassName=com.mysql.jdbc.Driver
spring.datasource.type=com.zaxxer.hikari.HikariDataSource
spring.datasource.hikari.connectionTimeout=1000
spring.datasource.hikari.idleTimeout=60000
spring.datasource.hikari.minimumIdle=2
spring.datasource.hikari.maximumPoolSize=20
spring.datasource.hikari.poolName=FmPool
spring.datasource.hikari.connectionTestQuery=SELECT 1
#-- The below three are causing problem to H2 configuration --
spring.datasource.hikari.autoCommit=false
spring.jpa.database-platform=com.intralot.l10.core.jpa.MySqlDialect
spring.jpa.hibernate.ddl-auto=none
while the application.properties
under src/test/resources
for h2 looks like below :
# H2 Console
spring.datasource.url=jdbc:h2:mem:db;DB_CLOSE_DELAY=-1
spring.datasource.username=admin
spring.datasource.password=password
spring.datasource.driver-class-name=org.h2.Driver
#spring.datasource.hikari.autoCommit=true
#spring.jpa.hibernate.ddl-auto=create-update
# JPA
spring.jpa.database-platform=org.hibernate.dialect.H2Dialect
# Flyway
spring.flyway.enabled=false
when i comment from application.properties
under src/java/resource
the below lines:
#-- The below three are causing problem to H2 configuration --
spring.datasource.hikari.autoCommit=false
spring.jpa.database-platform=com.intralot.l10.core.jpa.MySqlDialect
spring.jpa.hibernate.ddl-auto=none
the H2 configuration works well but i don't know why that happens ..
Is there any way i can completely ignore default application.properties
under src/java/resources
and use only the application.properties
under src/test/resources
?