Sets the child class loader to parent class loader.
This prevents odd behavior in jdk 11 + Fixes https://github.com/spring-cloud/spring-cloud-netflix/issues/3101
This commit is contained in:
@@ -19,6 +19,7 @@ package org.springframework.cloud.context.named;
|
||||
import java.util.Arrays;
|
||||
import java.util.Map;
|
||||
|
||||
import org.assertj.core.api.Assertions;
|
||||
import org.junit.Test;
|
||||
|
||||
import org.springframework.context.annotation.AnnotationConfigApplicationContext;
|
||||
@@ -65,6 +66,13 @@ public class NamedContextFactoryTests {
|
||||
AnnotationConfigApplicationContext fooContext = factory.getContext("foo");
|
||||
AnnotationConfigApplicationContext barContext = factory.getContext("bar");
|
||||
|
||||
then(fooContext.getClassLoader())
|
||||
.as("foo context classloader does not match parent")
|
||||
.isSameAs(parent.getClassLoader());
|
||||
|
||||
Assertions.assertThat(fooContext).hasFieldOrPropertyWithValue("customClassLoader",
|
||||
true);
|
||||
|
||||
factory.destroy();
|
||||
|
||||
then(fooContext.isActive()).as("foo context wasn't closed").isFalse();
|
||||
|
||||
Reference in New Issue
Block a user