diff --git a/backend/src/main/java/io/metersphere/engine/EngineFactory.java b/backend/src/main/java/io/metersphere/engine/EngineFactory.java index 83a8d445e5..e89df864e7 100644 --- a/backend/src/main/java/io/metersphere/engine/EngineFactory.java +++ b/backend/src/main/java/io/metersphere/engine/EngineFactory.java @@ -7,7 +7,6 @@ import io.metersphere.base.domain.FileMetadata; import io.metersphere.base.domain.LoadTestWithBLOBs; import io.metersphere.commons.constants.EngineType; import io.metersphere.commons.exception.MSException; -import io.metersphere.commons.utils.CommonBeanFactory; import io.metersphere.engine.docker.DockerTestEngine; import io.metersphere.engine.kubernetes.KubernetesTestEngine; import io.metersphere.parse.EngineSourceParser; @@ -22,9 +21,9 @@ public class EngineFactory { switch (type) { case DOCKER: - return CommonBeanFactory.getBean(DockerTestEngine.class); + return new DockerTestEngine(); case KUBERNETES: - return CommonBeanFactory.getBean(KubernetesTestEngine.class); + return new KubernetesTestEngine(); } return null; } diff --git a/backend/src/main/java/io/metersphere/engine/docker/DockerTestEngine.java b/backend/src/main/java/io/metersphere/engine/docker/DockerTestEngine.java index f82cbce655..1665b9f1f0 100644 --- a/backend/src/main/java/io/metersphere/engine/docker/DockerTestEngine.java +++ b/backend/src/main/java/io/metersphere/engine/docker/DockerTestEngine.java @@ -2,9 +2,7 @@ package io.metersphere.engine.docker; import io.metersphere.engine.Engine; import io.metersphere.engine.EngineContext; -import org.springframework.stereotype.Service; -@Service public class DockerTestEngine implements Engine { private EngineContext context; diff --git a/backend/src/main/java/io/metersphere/engine/kubernetes/KubernetesTestEngine.java b/backend/src/main/java/io/metersphere/engine/kubernetes/KubernetesTestEngine.java index 4f6a8f6d17..db7cf52f0b 100644 --- a/backend/src/main/java/io/metersphere/engine/kubernetes/KubernetesTestEngine.java +++ b/backend/src/main/java/io/metersphere/engine/kubernetes/KubernetesTestEngine.java @@ -11,11 +11,9 @@ import io.metersphere.engine.kubernetes.crds.jmeter.Jmeter; import io.metersphere.engine.kubernetes.crds.jmeter.JmeterSpec; import io.metersphere.engine.kubernetes.provider.ClientCredential; import io.metersphere.engine.kubernetes.provider.KubernetesProvider; -import org.springframework.stereotype.Service; import java.util.HashMap; -@Service public class KubernetesTestEngine implements Engine { private EngineContext context; diff --git a/backend/src/main/java/io/metersphere/parse/EngineSourceParserFactory.java b/backend/src/main/java/io/metersphere/parse/EngineSourceParserFactory.java index 57f315b49b..6659d8d17d 100644 --- a/backend/src/main/java/io/metersphere/parse/EngineSourceParserFactory.java +++ b/backend/src/main/java/io/metersphere/parse/EngineSourceParserFactory.java @@ -1,7 +1,6 @@ package io.metersphere.parse; import io.metersphere.commons.constants.FileType; -import io.metersphere.commons.utils.CommonBeanFactory; import io.metersphere.parse.xml.XmlEngineSourceParse; public class EngineSourceParserFactory { @@ -9,7 +8,7 @@ public class EngineSourceParserFactory { final FileType engineType = FileType.valueOf(type); if (FileType.JMX.equals(engineType)) { - return CommonBeanFactory.getBean(XmlEngineSourceParse.class); + return new XmlEngineSourceParse(); } return null; diff --git a/backend/src/main/java/io/metersphere/parse/xml/XmlEngineSourceParse.java b/backend/src/main/java/io/metersphere/parse/xml/XmlEngineSourceParse.java index d4f0d170ed..db8dfe02ae 100644 --- a/backend/src/main/java/io/metersphere/parse/xml/XmlEngineSourceParse.java +++ b/backend/src/main/java/io/metersphere/parse/xml/XmlEngineSourceParse.java @@ -4,7 +4,6 @@ import io.metersphere.engine.EngineContext; import io.metersphere.parse.EngineSourceParser; import io.metersphere.parse.xml.reader.DocumentParser; import io.metersphere.parse.xml.reader.DocumentParserFactory; -import org.springframework.stereotype.Service; import org.w3c.dom.Document; import org.xml.sax.InputSource; @@ -12,7 +11,6 @@ import javax.xml.parsers.DocumentBuilder; import javax.xml.parsers.DocumentBuilderFactory; import java.io.InputStream; -@Service public class XmlEngineSourceParse implements EngineSourceParser { @Override public String parse(EngineContext context, InputStream source) throws Exception { diff --git a/backend/src/main/java/io/metersphere/service/LoadTestService.java b/backend/src/main/java/io/metersphere/service/LoadTestService.java index 1ac1e5c13e..a31ec38747 100644 --- a/backend/src/main/java/io/metersphere/service/LoadTestService.java +++ b/backend/src/main/java/io/metersphere/service/LoadTestService.java @@ -161,7 +161,7 @@ public class LoadTestService { LogUtil.info("Load test started " + loadTest.getName()); // engine type (DOCKER|KUBERNETES) // todo set type - Engine engine = EngineFactory.createEngine(fileMetadata.getEngine()); + final Engine engine = EngineFactory.createEngine(fileMetadata.getEngine()); if (engine == null) { MSException.throwException(String.format("Test cannot be run,test ID:%s,file type:%s", request.getId(),