There are a load of places on the internet that give partial solutions to this common problem: XA Transactions, outside an application container. Here’s an attempt to put them all in one place.
Spring proponents will have you believe that “Unit Testing” of persistent classes is very hard without spring. This is not the case, and can be accomplished in only a few classes.
This is not spring-bashing - I’m sure that Spring is very useful for some. This is simply an alternative approach to one that was presented at InfoQ
Limitation is that the per service type configuration isn’t supported, but this is a start.
The ConcurrencyThrottleInterceptor is a great bit of stuff to limit your use of heavy weight resources.
Spring applications configured with XML take an age to start.
Using a horrible hack, we can override the parsing of the XML to set all “beans” to be lazy-init.
This might mean that the application being tested can start more quickly.
Better to not use spring, but when forced to…