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
9b6fa1e8
Commit
9b6fa1e8
authored
Oct 06, 2016
by
Andy Wilkinson
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Separate conditions that did and did not match in auto-config endpoint
Closes gh-7122
parent
c06dc33b
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
52 additions
and
12 deletions
+52
-12
AutoConfigurationReportEndpoint.java
...oot/actuate/endpoint/AutoConfigurationReportEndpoint.java
+52
-12
No files found.
spring-boot-actuator/src/main/java/org/springframework/boot/actuate/endpoint/AutoConfigurationReportEndpoint.java
View file @
9b6fa1e8
...
@@ -16,6 +16,8 @@
...
@@ -16,6 +16,8 @@
package
org
.
springframework
.
boot
.
actuate
.
endpoint
;
package
org
.
springframework
.
boot
.
actuate
.
endpoint
;
import
java.util.ArrayList
;
import
java.util.LinkedHashMap
;
import
java.util.List
;
import
java.util.List
;
import
java.util.Map
;
import
java.util.Map
;
...
@@ -66,27 +68,36 @@ public class AutoConfigurationReportEndpoint extends AbstractEndpoint<Report> {
...
@@ -66,27 +68,36 @@ public class AutoConfigurationReportEndpoint extends AbstractEndpoint<Report> {
@JsonInclude
(
Include
.
NON_EMPTY
)
@JsonInclude
(
Include
.
NON_EMPTY
)
public
static
class
Report
{
public
static
class
Report
{
private
MultiValueMap
<
String
,
MessageAndCondition
>
positiveMatches
;
private
final
MultiValueMap
<
String
,
MessageAndCondition
>
positiveMatches
;
private
MultiValueMap
<
String
,
MessageAndCondition
>
negativeMatches
;
private
final
Map
<
String
,
MessageAndConditions
>
negativeMatches
;
private
List
<
String
>
exclusions
;
private
final
List
<
String
>
exclusions
;
private
Report
parent
;
private
final
Report
parent
;
public
Report
(
ConditionEvaluationReport
report
)
{
public
Report
(
ConditionEvaluationReport
report
)
{
this
.
positiveMatches
=
new
LinkedMultiValueMap
<
String
,
MessageAndCondition
>();
this
.
positiveMatches
=
new
LinkedMultiValueMap
<
String
,
MessageAndCondition
>();
this
.
negativeMatches
=
new
Linked
MultiValueMap
<
String
,
MessageAndCondition
>();
this
.
negativeMatches
=
new
Linked
HashMap
<
String
,
MessageAndConditions
>();
this
.
exclusions
=
report
.
getExclusions
();
this
.
exclusions
=
report
.
getExclusions
();
for
(
Map
.
Entry
<
String
,
ConditionAndOutcomes
>
entry
:
report
for
(
Map
.
Entry
<
String
,
ConditionAndOutcomes
>
entry
:
report
.
getConditionAndOutcomesBySource
().
entrySet
())
{
.
getConditionAndOutcomesBySource
().
entrySet
())
{
add
(
entry
.
getValue
().
isFullMatch
()
?
this
.
positiveMatches
if
(
entry
.
getValue
().
isFullMatch
())
{
:
this
.
nega
tiveMatches
,
entry
.
getKey
(),
entry
.
getValue
());
add
(
this
.
posi
tiveMatches
,
entry
.
getKey
(),
entry
.
getValue
());
}
}
else
{
if
(
report
.
getParent
()
!=
null
)
{
add
(
this
.
negativeMatches
,
entry
.
getKey
(),
entry
.
getValue
());
this
.
parent
=
new
Report
(
report
.
getParent
());
}
}
}
this
.
parent
=
report
.
getParent
()
!=
null
?
new
Report
(
report
.
getParent
())
:
null
;
}
private
void
add
(
Map
<
String
,
MessageAndConditions
>
map
,
String
source
,
ConditionAndOutcomes
conditionAndOutcomes
)
{
String
name
=
ClassUtils
.
getShortName
(
source
);
map
.
put
(
name
,
new
MessageAndConditions
(
conditionAndOutcomes
));
}
}
private
void
add
(
MultiValueMap
<
String
,
MessageAndCondition
>
map
,
String
source
,
private
void
add
(
MultiValueMap
<
String
,
MessageAndCondition
>
map
,
String
source
,
...
@@ -101,7 +112,7 @@ public class AutoConfigurationReportEndpoint extends AbstractEndpoint<Report> {
...
@@ -101,7 +112,7 @@ public class AutoConfigurationReportEndpoint extends AbstractEndpoint<Report> {
return
this
.
positiveMatches
;
return
this
.
positiveMatches
;
}
}
public
Map
<
String
,
List
<
MessageAndCondition
>
>
getNegativeMatches
()
{
public
Map
<
String
,
MessageAndConditions
>
getNegativeMatches
()
{
return
this
.
negativeMatches
;
return
this
.
negativeMatches
;
}
}
...
@@ -115,6 +126,34 @@ public class AutoConfigurationReportEndpoint extends AbstractEndpoint<Report> {
...
@@ -115,6 +126,34 @@ public class AutoConfigurationReportEndpoint extends AbstractEndpoint<Report> {
}
}
/**
* Adapts {@link ConditionAndOutcomes} to a JSON friendly structure.
*/
@JsonPropertyOrder
({
"notMatched"
,
"matched"
})
public
static
class
MessageAndConditions
{
private
final
List
<
MessageAndCondition
>
notMatched
=
new
ArrayList
<
MessageAndCondition
>();
private
final
List
<
MessageAndCondition
>
matched
=
new
ArrayList
<
MessageAndCondition
>();
public
MessageAndConditions
(
ConditionAndOutcomes
conditionAndOutcomes
)
{
for
(
ConditionAndOutcome
conditionAndOutcome
:
conditionAndOutcomes
)
{
List
<
MessageAndCondition
>
target
=
conditionAndOutcome
.
getOutcome
()
.
isMatch
()
?
this
.
matched
:
this
.
notMatched
;
target
.
add
(
new
MessageAndCondition
(
conditionAndOutcome
));
}
}
public
List
<
MessageAndCondition
>
getNotMatched
()
{
return
this
.
notMatched
;
}
public
List
<
MessageAndCondition
>
getMatched
()
{
return
this
.
matched
;
}
}
/**
/**
* Adapts {@link ConditionAndOutcome} to a JSON friendly structure.
* Adapts {@link ConditionAndOutcome} to a JSON friendly structure.
*/
*/
...
@@ -146,4 +185,5 @@ public class AutoConfigurationReportEndpoint extends AbstractEndpoint<Report> {
...
@@ -146,4 +185,5 @@ public class AutoConfigurationReportEndpoint extends AbstractEndpoint<Report> {
}
}
}
}
}
}
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