Spring’s embedded H2 datasource and DB_CLOSE_ON_EXIT

后端 未结 3 512
悲哀的现实
悲哀的现实 2020-12-24 05:37

For unit tests (call them integration tests if you want) I have configured an embedded database in my Spring config like so:



        
3条回答
  •  挽巷
    挽巷 (楼主)
    2020-12-24 06:28

    I had the same issue as Michael Piefel's one, and tried to implement the solution that Michail Nikolaev explained. but it did not work, somehow spring-batch, then, where are the metadata JOB_* tables are. So, as the version of spring-jdbc used by my application is 3.0.5 and increasing the spring-framework one enters in conflict with dwr (i use it in my app) it's a geo localisation based on spring, dwr and gmaps api. I downloaded the spring-jdbc 4.0.3 release and get from it the H2EmbeddedDatabaseConfigurer.class who has DB_CLOSE_ON_EXIT=FALSE by default and replace with it the one on the spring-jdbc 3.0.5 Relase and deploy-it in the war file and it works, the shutdown of the VM didn't provoque the closing of the in memory database.

    Hope this unusual solution helps if other people as me wouldn't be able to implement the other solution.

提交回复
热议问题