diff --git a/backend/src/main/java/io/metersphere/performance/engine/EngineFactory.java b/backend/src/main/java/io/metersphere/performance/engine/EngineFactory.java index d5662a87c3..c0af7b8b76 100644 --- a/backend/src/main/java/io/metersphere/performance/engine/EngineFactory.java +++ b/backend/src/main/java/io/metersphere/performance/engine/EngineFactory.java @@ -31,6 +31,7 @@ import org.reflections8.Reflections; import org.springframework.stereotype.Service; import org.springframework.transaction.annotation.Transactional; +import javax.annotation.PostConstruct; import javax.annotation.Resource; import java.io.ByteArrayInputStream; import java.io.InputStream; @@ -46,8 +47,9 @@ public class EngineFactory { private static TestResourcePoolService testResourcePoolService; private static Class kubernetesTestEngineClass; - static { - Reflections reflections = new Reflections(Application.class.getPackage().getName()); + @PostConstruct + public void init() { + Reflections reflections = new Reflections(Application.class); Set> implClass = reflections.getSubTypesOf(KubernetesTestEngine.class); for (Class aClass : implClass) { kubernetesTestEngineClass = aClass;