File tree Expand file tree Collapse file tree 1 file changed +14
-13
lines changed
utbot-spring-commons/src/main/kotlin/org/utbot/spring/instantiator Expand file tree Collapse file tree 1 file changed +14
-13
lines changed Original file line number Diff line number Diff line change @@ -19,18 +19,19 @@ class SpringApplicationInstantiatorFacade(private val instantiationContext: Inst
1919 logger.info { " Current Spring version is: " + runCatching { SpringVersion .getVersion() }.getOrNull() }
2020 logger.info { " Current Spring Boot version is: " + runCatching { SpringBootVersion .getVersion() }.getOrNull() }
2121
22- val environmentFactory = EnvironmentFactory (instantiationContext)
23-
24- val suitableInstantiator =
25- listOf (SpringBootApplicationInstantiator (), PureSpringApplicationInstantiator ())
26- .firstOrNull { it.canInstantiate() }
27- ? : null .also { logger.error { " All Spring analyzers failed, using empty bean list" } }
28-
29- logger.info { " Instantiating Spring application with $suitableInstantiator " }
30-
31- return suitableInstantiator?.instantiate(
32- instantiationContext.configurationClasses,
33- environmentFactory.createEnvironment(),
34- )
22+ val environment = EnvironmentFactory (instantiationContext).createEnvironment()
23+
24+ for (instantiator in listOf (SpringBootApplicationInstantiator (), PureSpringApplicationInstantiator ())) {
25+ if (instantiator.canInstantiate()) {
26+ logger.info { " Instantiating with $instantiator " }
27+ try {
28+ return instantiator.instantiate(instantiationContext.configurationClasses, environment)
29+ } catch (e: Throwable ) {
30+ logger.error(" Instantiating with $instantiator failed" , e)
31+ }
32+ }
33+ }
34+
35+ return null
3536 }
3637}
You can’t perform that action at this time.
0 commit comments