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
83d4d94e
Commit
83d4d94e
authored
Oct 22, 2019
by
Phillip Webb
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Cache ModifiedClassPathClassLoaders
Closes gh-18694
parent
8d08d654
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
8 additions
and
0 deletions
+8
-0
ModifiedClassPathClassLoader.java
...t/testsupport/classpath/ModifiedClassPathClassLoader.java
+8
-0
No files found.
spring-boot-project/spring-boot-tools/spring-boot-test-support/src/main/java/org/springframework/boot/testsupport/classpath/ModifiedClassPathClassLoader.java
View file @
83d4d94e
...
@@ -25,6 +25,7 @@ import java.util.ArrayList;
...
@@ -25,6 +25,7 @@ import java.util.ArrayList;
import
java.util.Arrays
;
import
java.util.Arrays
;
import
java.util.Collections
;
import
java.util.Collections
;
import
java.util.List
;
import
java.util.List
;
import
java.util.Map
;
import
java.util.jar.Attributes
;
import
java.util.jar.Attributes
;
import
java.util.jar.JarFile
;
import
java.util.jar.JarFile
;
import
java.util.regex.Pattern
;
import
java.util.regex.Pattern
;
...
@@ -50,6 +51,7 @@ import org.eclipse.aether.transport.http.HttpTransporterFactory;
...
@@ -50,6 +51,7 @@ import org.eclipse.aether.transport.http.HttpTransporterFactory;
import
org.springframework.core.annotation.MergedAnnotation
;
import
org.springframework.core.annotation.MergedAnnotation
;
import
org.springframework.core.annotation.MergedAnnotations
;
import
org.springframework.core.annotation.MergedAnnotations
;
import
org.springframework.util.AntPathMatcher
;
import
org.springframework.util.AntPathMatcher
;
import
org.springframework.util.ConcurrentReferenceHashMap
;
import
org.springframework.util.StringUtils
;
import
org.springframework.util.StringUtils
;
/**
/**
...
@@ -60,6 +62,8 @@ import org.springframework.util.StringUtils;
...
@@ -60,6 +62,8 @@ import org.springframework.util.StringUtils;
*/
*/
final
class
ModifiedClassPathClassLoader
extends
URLClassLoader
{
final
class
ModifiedClassPathClassLoader
extends
URLClassLoader
{
private
static
final
Map
<
Class
<?>,
ModifiedClassPathClassLoader
>
cache
=
new
ConcurrentReferenceHashMap
<>();
private
static
final
Pattern
INTELLIJ_CLASSPATH_JAR_PATTERN
=
Pattern
.
compile
(
".*classpath(\\d+)?\\.jar"
);
private
static
final
Pattern
INTELLIJ_CLASSPATH_JAR_PATTERN
=
Pattern
.
compile
(
".*classpath(\\d+)?\\.jar"
);
private
final
ClassLoader
junitLoader
;
private
final
ClassLoader
junitLoader
;
...
@@ -78,6 +82,10 @@ final class ModifiedClassPathClassLoader extends URLClassLoader {
...
@@ -78,6 +82,10 @@ final class ModifiedClassPathClassLoader extends URLClassLoader {
}
}
static
ModifiedClassPathClassLoader
get
(
Class
<?>
testClass
)
{
static
ModifiedClassPathClassLoader
get
(
Class
<?>
testClass
)
{
return
cache
.
computeIfAbsent
(
testClass
,
ModifiedClassPathClassLoader:
:
compute
);
}
private
static
ModifiedClassPathClassLoader
compute
(
Class
<?>
testClass
)
{
ClassLoader
classLoader
=
testClass
.
getClassLoader
();
ClassLoader
classLoader
=
testClass
.
getClassLoader
();
return
new
ModifiedClassPathClassLoader
(
processUrls
(
extractUrls
(
classLoader
),
testClass
),
return
new
ModifiedClassPathClassLoader
(
processUrls
(
extractUrls
(
classLoader
),
testClass
),
classLoader
.
getParent
(),
classLoader
);
classLoader
.
getParent
(),
classLoader
);
...
...
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