Browse Source

Detect AOT when creating context without parent.

pull/1135/head
Olga Maciaszek-Sharma 3 years ago
parent
commit
da0f3a57ec
  1. 3
      spring-cloud-context/src/main/java/org/springframework/cloud/context/named/NamedContextFactory.java

3
spring-cloud-context/src/main/java/org/springframework/cloud/context/named/NamedContextFactory.java

@ -166,7 +166,8 @@ public abstract class NamedContextFactory<C extends NamedContextFactory.Specific @@ -166,7 +166,8 @@ public abstract class NamedContextFactory<C extends NamedContextFactory.Specific
context.setClassLoader(parent.getClassLoader());
}
else {
context = new GenericApplicationContext();
context = AotDetector.useGeneratedArtifacts() ? new GenericApplicationContext()
: new AnnotationConfigApplicationContext();
}
context.getEnvironment().getPropertySources().addFirst(
new MapPropertySource(this.propertySourceName, Collections.singletonMap(this.propertyName, name)));

Loading…
Cancel
Save