How to add the mode=mysql to embedded H2 DB in Spring Boot 1.4.1 for @DataJpaTest?

前端 未结 5 2105
自闭症患者
自闭症患者 2020-12-18 20:41

I have some problems with using a schema.sql file to create my sql schema when executing a junit test while this schema contains mysql specific expression. I have to add the

5条回答
  •  伪装坚强ぢ
    2020-12-18 20:57

    I have tried similiar approaches to get this to work, but spring does not take the spring.datasource.url=jdbc:h2:mem:testdb;MODE=MYSQL from my test-application.properties

    Did you try to append this parameters instead of rewriting the existing ones?

    spring.datasource.url=jdbc:h2:mem:testdb;DB_CLOSE_DELAY=-1;DB_CLOSE_ON_EXIT=FALSE;MODE=MYSQL
    

    All other settings from my test-application.properties have been read successfully.

    I thought that file should be named application-test.properties.

提交回复
热议问题