|
|
|
@ -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,10 +218,10 @@ 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); |
|
|
|
@ -231,6 +230,7 @@ class RestartClassLoaderTests { |
|
|
|
.isEqualTo(ExampleTransactional.class.getClassLoader()); |
|
|
|
.isEqualTo(ExampleTransactional.class.getClassLoader()); |
|
|
|
}); |
|
|
|
}); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
private String readString(InputStream in) throws IOException { |
|
|
|
private String readString(InputStream in) throws IOException { |
|
|
|
return new String(FileCopyUtils.copyToByteArray(in)); |
|
|
|
return new String(FileCopyUtils.copyToByteArray(in)); |
|
|
|
|