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
f0bc3c08
Commit
f0bc3c08
authored
Dec 08, 2014
by
Phillip Webb
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Add additional ElementExcludeFilter items
Fixes gh-2088
parent
2b914712
Changes
4
Show whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
31 additions
and
6 deletions
+31
-6
ConfigurationMetadataAnnotationProcessor.java
...onprocessor/ConfigurationMetadataAnnotationProcessor.java
+2
-1
ElementExcludeFilter.java
...ork/boot/configurationprocessor/ElementExcludeFilter.java
+18
-5
ConfigurationMetadataAnnotationProcessorTests.java
...cessor/ConfigurationMetadataAnnotationProcessorTests.java
+1
-0
ExcludedTypesPojo.java
.../boot/configurationsample/specific/ExcludedTypesPojo.java
+10
-0
No files found.
spring-boot-tools/spring-boot-configuration-processor/src/main/java/org/springframework/boot/configurationprocessor/ConfigurationMetadataAnnotationProcessor.java
View file @
f0bc3c08
...
...
@@ -179,7 +179,8 @@ public class ConfigurationMetadataAnnotationProcessor extends AbstractProcessor
VariableElement
field
=
members
.
getFields
().
get
(
name
);
Element
returnType
=
this
.
processingEnv
.
getTypeUtils
().
asElement
(
getter
.
getReturnType
());
boolean
isExcluded
=
this
.
elementExcludeFilter
.
isExcluded
(
returnType
);
boolean
isExcluded
=
this
.
elementExcludeFilter
.
isExcluded
(
getter
.
getReturnType
());
boolean
isNested
=
isNested
(
returnType
,
field
,
element
);
boolean
isCollection
=
this
.
typeUtils
.
isCollectionOrMap
(
getter
.
getReturnType
());
...
...
spring-boot-tools/spring-boot-configuration-processor/src/main/java/org/springframework/boot/configurationprocessor/ElementExcludeFilter.java
View file @
f0bc3c08
...
...
@@ -19,7 +19,7 @@ package org.springframework.boot.configurationprocessor;
import
java.util.HashSet
;
import
java.util.Set
;
import
javax.lang.model.
element.Element
;
import
javax.lang.model.
type.TypeMirror
;
/**
* Filter to excluded elements that don't make sense to process.
...
...
@@ -34,19 +34,32 @@ class ElementExcludeFilter {
public
ElementExcludeFilter
()
{
add
(
"java.io.Writer"
);
add
(
"java.io.PrintWriter"
);
add
(
"javax.sql.DataSource"
);
add
(
"java.lang.ClassLoader"
);
add
(
"java.util.concurrent.ThreadFactory"
);
add
(
"javax.sql.DataSource"
);
add
(
"com.zaxxer.hikari.IConnectionCustomizer"
);
add
(
"groovy.text.markup.MarkupTemplateEngine"
);
add
(
"org.apache.tomcat.jdbc.pool.PoolConfiguration"
);
add
(
"org.apache.tomcat.jdbc.pool.Validator"
);
add
(
"org.flywaydb.core.api.MigrationVersion"
);
add
(
"org.flywaydb.core.api.callback.FlywayCallback"
);
add
(
"org.flywaydb.core.api.resolver.MigrationResolver"
);
add
(
"org.springframework.http.MediaType"
);
}
private
void
add
(
String
className
)
{
this
.
excludes
.
add
(
className
);
}
public
boolean
isExcluded
(
Element
element
)
{
if
(
element
==
null
)
{
public
boolean
isExcluded
(
TypeMirror
type
)
{
if
(
type
==
null
)
{
return
false
;
}
return
this
.
excludes
.
contains
(
element
.
toString
());
String
typeName
=
type
.
toString
();
if
(
typeName
.
endsWith
(
"[]"
))
{
typeName
=
typeName
.
substring
(
0
,
typeName
.
length
()
-
2
);
}
return
this
.
excludes
.
contains
(
typeName
);
}
}
spring-boot-tools/spring-boot-configuration-processor/src/test/java/org/springframework/boot/configurationprocessor/ConfigurationMetadataAnnotationProcessorTests.java
View file @
f0bc3c08
...
...
@@ -283,6 +283,7 @@ public class ConfigurationMetadataAnnotationProcessorTests {
assertThat
(
metadata
,
not
(
containsProperty
(
"excluded.data-source"
)));
assertThat
(
metadata
,
not
(
containsProperty
(
"excluded.print-writer"
)));
assertThat
(
metadata
,
not
(
containsProperty
(
"excluded.writer"
)));
assertThat
(
metadata
,
not
(
containsProperty
(
"excluded.writer-array"
)));
}
private
ConfigurationMetadata
compile
(
Class
<?>...
types
)
throws
IOException
{
...
...
spring-boot-tools/spring-boot-configuration-processor/src/test/java/org/springframework/boot/configurationsample/specific/ExcludedTypesPojo.java
View file @
f0bc3c08
...
...
@@ -42,6 +42,8 @@ public class ExcludedTypesPojo {
private
Writer
writer
;
private
Writer
[]
writerArray
;
public
String
getName
()
{
return
this
.
name
;
}
...
...
@@ -82,4 +84,12 @@ public class ExcludedTypesPojo {
this
.
writer
=
writer
;
}
public
Writer
[]
getWriterArray
()
{
return
this
.
writerArray
;
}
public
void
setWriterArray
(
Writer
[]
writerArray
)
{
this
.
writerArray
=
writerArray
;
}
}
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