I have configured an in-memory HSQLDB for my SpringJUnit4ClassRunner
-based integration tests.
Say I have N distinct Spring context configurations resulting in as many key/value entries in the context cache map - as defined by Spring documentation: Context caching.
My question is: is it possible that two different Spring contexts (as defined per above) share the same HSQLDB database instance?
In other words is the data held in an in-memory instance of HSQLDB shared between all Spring contexts configurations or does each distinct Spring context configuration get its own instance of HSQLDB data?
My question is: is it possible that two different Spring contexts (as defined per above) share the same HSQLDB database instance?
Yes, if you do not explicitly give the embedded databases unique names, then only one embedded database will be created in the JVM.
See SPR-8849 for further details and custom work-arounds.
Regards,
Sam