diff --git a/src/main/java/org/concordion/internal/FixtureSpecificationMapper.java b/src/main/java/org/concordion/internal/FixtureSpecificationMapper.java index da8fea6b3..e14f4fbdc 100644 --- a/src/main/java/org/concordion/internal/FixtureSpecificationMapper.java +++ b/src/main/java/org/concordion/internal/FixtureSpecificationMapper.java @@ -18,7 +18,12 @@ */ public class FixtureSpecificationMapper { - private static ServiceLoader serviceLoader = ServiceLoader.load(TestFrameworkProvider.class); + private static ThreadLocal serviceLoaderHolder = new ThreadLocal>() { + @Override + protected ServiceLoader initialValue() { + return ServiceLoader.load(TestFrameworkProvider.class); + } + }; public static Resource toSpecificationResource(Object fixture, String specificationSuffix) { String slashedClassName = fixture.getClass().getName().replaceAll("\\.", "/"); @@ -49,6 +54,7 @@ public static Class findFixtureClass(Resource hrefResource) throws ClassNotFo private static Class getFixtureClass(String name) throws ClassNotFoundException { try { Class clazz = Class.forName(name); + ServiceLoader serviceLoader = (ServiceLoader) serviceLoaderHolder.get(); Iterator iterator = serviceLoader.iterator(); while (iterator.hasNext()) { TestFrameworkProvider provider = iterator.next();