Commit b5843cfd authored by Andy Wilkinson's avatar Andy Wilkinson

Merge branch '2.4.x'

parents 46baf462 24d729ee
...@@ -20,7 +20,6 @@ import java.io.File; ...@@ -20,7 +20,6 @@ import java.io.File;
import java.io.FileOutputStream; import java.io.FileOutputStream;
import java.io.IOException; import java.io.IOException;
import java.io.InputStream; import java.io.InputStream;
import java.net.MalformedURLException;
import java.net.URL; import java.net.URL;
import java.net.URLClassLoader; import java.net.URLClassLoader;
import java.nio.charset.StandardCharsets; import java.nio.charset.StandardCharsets;
...@@ -219,17 +218,18 @@ class RestartClassLoaderTests { ...@@ -219,17 +218,18 @@ class RestartClassLoaderTests {
} }
@Test @Test
void packagePrivateClassLoadedByParentClassLoaderCanBeProxied() throws MalformedURLException { void packagePrivateClassLoadedByParentClassLoaderCanBeProxied() throws IOException {
new ApplicationContextRunner() try (RestartClassLoader restartClassLoader = new RestartClassLoader(ExampleTransactional.class.getClassLoader(),
.withClassLoader(new RestartClassLoader(ExampleTransactional.class.getClassLoader(), new URL[] { this.sampleJarFile.toURI().toURL() }, this.updatedFiles)) {
new URL[] { this.sampleJarFile.toURI().toURL() }, this.updatedFiles)) new ApplicationContextRunner().withClassLoader(restartClassLoader)
.withUserConfiguration(ProxyConfiguration.class).run((context) -> { .withUserConfiguration(ProxyConfiguration.class).run((context) -> {
assertThat(context).hasNotFailed(); assertThat(context).hasNotFailed();
ExampleTransactional transactional = context.getBean(ExampleTransactional.class); ExampleTransactional transactional = context.getBean(ExampleTransactional.class);
assertThat(AopUtils.isCglibProxy(transactional)).isTrue(); assertThat(AopUtils.isCglibProxy(transactional)).isTrue();
assertThat(transactional.getClass().getClassLoader()) assertThat(transactional.getClass().getClassLoader())
.isEqualTo(ExampleTransactional.class.getClassLoader()); .isEqualTo(ExampleTransactional.class.getClassLoader());
}); });
}
} }
private String readString(InputStream in) throws IOException { private String readString(InputStream in) throws IOException {
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment