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
df6feb3e
Commit
df6feb3e
authored
Jul 25, 2018
by
artsiom
Committed by
Stephane Nicoll
Jul 26, 2018
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Make SpringBootConfigurationFinder public and usable with other annotations
See gh-13904
parent
e60af724
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
18 additions
and
4 deletions
+18
-4
SpringBootConfigurationFinder.java
...work/boot/test/context/SpringBootConfigurationFinder.java
+18
-4
No files found.
spring-boot-project/spring-boot-test/src/main/java/org/springframework/boot/test/context/SpringBootConfigurationFinder.java
View file @
df6feb3e
...
@@ -16,6 +16,7 @@
...
@@ -16,6 +16,7 @@
package
org
.
springframework
.
boot
.
test
.
context
;
package
org
.
springframework
.
boot
.
test
.
context
;
import
java.lang.annotation.Annotation
;
import
java.util.Collections
;
import
java.util.Collections
;
import
java.util.LinkedHashMap
;
import
java.util.LinkedHashMap
;
import
java.util.Map
;
import
java.util.Map
;
...
@@ -29,21 +30,34 @@ import org.springframework.util.Assert;
...
@@ -29,21 +30,34 @@ import org.springframework.util.Assert;
import
org.springframework.util.ClassUtils
;
import
org.springframework.util.ClassUtils
;
/**
/**
*
Internal utility class to scan for a {@link SpringBootConfiguration} class
.
*
Utility class to scan for a {@link SpringBootConfiguration} or custom annotation
.
*
*
* @author Phillip Webb
* @author Phillip Webb
* @author Artsiom Yudovin
* @since 2.1.0
*/
*/
final
class
SpringBootConfigurationFinder
{
public
final
class
SpringBootConfigurationFinder
{
private
static
final
Map
<
String
,
Class
<?>>
cache
=
Collections
private
static
final
Map
<
String
,
Class
<?>>
cache
=
Collections
.
synchronizedMap
(
new
Cache
(
40
));
.
synchronizedMap
(
new
Cache
(
40
));
private
final
ClassPathScanningCandidateComponentProvider
scanner
;
private
final
ClassPathScanningCandidateComponentProvider
scanner
;
SpringBootConfigurationFinder
()
{
/**
* Default constructor initializing finder to scan for a {@link SpringBootConfiguration} annotation.
*/
public
SpringBootConfigurationFinder
()
{
this
(
SpringBootConfiguration
.
class
);
}
/**
* Customiable constructor allow to provide the custom annotation to scan for.
* @param annotationType Annotation to scan for.
*/
public
SpringBootConfigurationFinder
(
Class
<?
extends
Annotation
>
annotationType
)
{
this
.
scanner
=
new
ClassPathScanningCandidateComponentProvider
(
false
);
this
.
scanner
=
new
ClassPathScanningCandidateComponentProvider
(
false
);
this
.
scanner
.
addIncludeFilter
(
this
.
scanner
.
addIncludeFilter
(
new
AnnotationTypeFilter
(
SpringBootConfiguration
.
class
));
new
AnnotationTypeFilter
(
annotationType
));
this
.
scanner
.
setResourcePattern
(
"*.class"
);
this
.
scanner
.
setResourcePattern
(
"*.class"
);
}
}
...
...
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