Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Sign in / Register
Toggle navigation
S
spring-boot
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
DEMO
spring-boot
Commits
24d729ee
Commit
24d729ee
authored
Mar 11, 2021
by
Andy Wilkinson
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Close ClassLoader so jar it references can be deleted on Windows
Polishes
952ac7b8
parent
c43ae0b2
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
12 additions
and
12 deletions
+12
-12
RestartClassLoaderTests.java
...devtools/restart/classloader/RestartClassLoaderTests.java
+12
-12
No files found.
spring-boot-project/spring-boot-devtools/src/test/java/org/springframework/boot/devtools/restart/classloader/RestartClassLoaderTests.java
View file @
24d729ee
...
...
@@ -20,7 +20,6 @@ import java.io.File;
import
java.io.FileOutputStream
;
import
java.io.IOException
;
import
java.io.InputStream
;
import
java.net.MalformedURLException
;
import
java.net.URL
;
import
java.net.URLClassLoader
;
import
java.nio.charset.StandardCharsets
;
...
...
@@ -219,17 +218,18 @@ class RestartClassLoaderTests {
}
@Test
void
packagePrivateClassLoadedByParentClassLoaderCanBeProxied
()
throws
MalformedURLException
{
new
ApplicationContextRunner
()
.
withClassLoader
(
new
RestartClassLoader
(
ExampleTransactional
.
class
.
getClassLoader
(),
new
URL
[]
{
this
.
sampleJarFile
.
toURI
().
toURL
()
},
this
.
updatedFiles
))
.
withUserConfiguration
(
ProxyConfiguration
.
class
).
run
((
context
)
->
{
assertThat
(
context
).
hasNotFailed
();
ExampleTransactional
transactional
=
context
.
getBean
(
ExampleTransactional
.
class
);
assertThat
(
AopUtils
.
isCglibProxy
(
transactional
)).
isTrue
();
assertThat
(
transactional
.
getClass
().
getClassLoader
())
.
isEqualTo
(
ExampleTransactional
.
class
.
getClassLoader
());
});
void
packagePrivateClassLoadedByParentClassLoaderCanBeProxied
()
throws
IOException
{
try
(
RestartClassLoader
restartClassLoader
=
new
RestartClassLoader
(
ExampleTransactional
.
class
.
getClassLoader
(),
new
URL
[]
{
this
.
sampleJarFile
.
toURI
().
toURL
()
},
this
.
updatedFiles
))
{
new
ApplicationContextRunner
().
withClassLoader
(
restartClassLoader
)
.
withUserConfiguration
(
ProxyConfiguration
.
class
).
run
((
context
)
->
{
assertThat
(
context
).
hasNotFailed
();
ExampleTransactional
transactional
=
context
.
getBean
(
ExampleTransactional
.
class
);
assertThat
(
AopUtils
.
isCglibProxy
(
transactional
)).
isTrue
();
assertThat
(
transactional
.
getClass
().
getClassLoader
())
.
isEqualTo
(
ExampleTransactional
.
class
.
getClassLoader
());
});
}
}
private
String
readString
(
InputStream
in
)
throws
IOException
{
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment