@@ -22,6 +22,7 @@ import org.utbot.instrumentation.instrumentation.execution.context.Instrumentati
2222import org.utbot.instrumentation.instrumentation.execution.phases.ExecutionPhaseFailingOnAnyException
2323import org.utbot.instrumentation.instrumentation.execution.phases.PhasesController
2424import org.utbot.spring.api.SpringApi
25+ import java.io.File
2526import java.net.URL
2627import java.net.URLClassLoader
2728import java.security.ProtectionDomain
@@ -50,6 +51,14 @@ class SpringUtExecutionInstrumentation(
5051 companion object {
5152 private val logger = getLogger<SpringUtExecutionInstrumentation >()
5253 private const val SPRING_COMMONS_JAR_FILENAME = " utbot-spring-commons-shadow.jar"
54+
55+ val springCommonsJar: File by lazy {
56+ JarUtils .extractJarFileFromResources(
57+ jarFileName = SPRING_COMMONS_JAR_FILENAME ,
58+ jarResourcePath = " lib/$SPRING_COMMONS_JAR_FILENAME " ,
59+ targetDirectoryName = " spring-commons"
60+ )
61+ }
5362 }
5463
5564 fun tryLoadingSpringContext (): ConcreteContextLoadingResult {
@@ -147,11 +156,7 @@ class SpringUtExecutionInstrumentation(
147156 private val buildDirs : Array <URL >,
148157 ) : UtExecutionInstrumentation.Factory<SpringUtExecutionInstrumentation> {
149158 override val additionalRuntimeClasspath: Set <String >
150- get() = super .additionalRuntimeClasspath + JarUtils .extractJarFileFromResources(
151- jarFileName = SPRING_COMMONS_JAR_FILENAME ,
152- jarResourcePath = " lib/$SPRING_COMMONS_JAR_FILENAME " ,
153- targetDirectoryName = " spring-commons"
154- ).path
159+ get() = super .additionalRuntimeClasspath + springCommonsJar.path
155160
156161 // TODO may be we can use some alternative sandbox that has more permissions
157162 // (at the very least we need `ReflectPermission("suppressAccessChecks")`
0 commit comments