Avoid unnecessary synchronization in ContextCache, plus forward-ported polishing

Issue: SPR-12409
This commit is contained in:
Juergen Hoeller
2014-11-06 17:15:30 +01:00
parent 6a96850aa7
commit 74500ec8da
7 changed files with 130 additions and 194 deletions

View File

@@ -24,21 +24,15 @@ package org.springframework.test.context;
*/
public abstract class TestContextTestUtils {
private TestContextTestUtils() {
/* no-op */
}
public static TestContext buildTestContext(Class<?> testClass, ContextCache contextCache) {
CacheAwareContextLoaderDelegate cacheAwareContextLoaderDelegate = new DefaultCacheAwareContextLoaderDelegate(
contextCache);
return buildTestContext(testClass, null, cacheAwareContextLoaderDelegate);
return buildTestContext(testClass, new DefaultCacheAwareContextLoaderDelegate(contextCache));
}
public static TestContext buildTestContext(Class<?> testClass, String customDefaultContextLoaderClassName,
CacheAwareContextLoaderDelegate cacheAwareContextLoaderDelegate) {
public static TestContext buildTestContext(
Class<?> testClass, CacheAwareContextLoaderDelegate cacheAwareContextLoaderDelegate) {
BootstrapContext bootstrapContext = new DefaultBootstrapContext(testClass, cacheAwareContextLoaderDelegate);
TestContextBootstrapper testContextBootstrapper = BootstrapUtils.resolveTestContextBootstrapper(bootstrapContext);
return new DefaultTestContext(testContextBootstrapper);
}

View File

@@ -13,6 +13,7 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.springframework.test.web.client;
import java.net.URI;