Spring configuration for embedded H2 database for tests

后端 未结 4 2234
忘了有多久
忘了有多久 2020-12-02 07:04

What does your Spring configuration for integration tests look like using an embedded h2 datasource and, optionally, JUnit?

My first try with a SingleConnectionDataS

4条回答
  •  自闭症患者
    2020-12-02 08:04

    H2 is bundled with a built-in connection pool implementation. The following XML provides an example of using it as a Datasource bean without a need to introduce additional dependencies on DBCP or C3P0:

    
        
            
                
                
                
             
        
     
    

    The database will be shut down by calling a dispose method when Spring application context closes.

提交回复
热议问题