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
d5264664
Commit
d5264664
authored
Jun 09, 2021
by
Phillip Webb
Browse files
Options
Browse Files
Download
Plain Diff
Merge branch '2.3.x' into 2.4.x
Closes gh-26822
parents
4d62e47c
1f6983c4
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
17 additions
and
3 deletions
+17
-3
CompositeHealth.java
.../springframework/boot/actuate/health/CompositeHealth.java
+2
-2
CompositeHealthTests.java
...ngframework/boot/actuate/health/CompositeHealthTests.java
+15
-1
No files found.
spring-boot-project/spring-boot-actuator/src/main/java/org/springframework/boot/actuate/health/CompositeHealth.java
View file @
d5264664
/*
/*
* Copyright 2012-20
19
the original author or authors.
* Copyright 2012-20
21
the original author or authors.
*
*
* Licensed under the Apache License, Version 2.0 (the "License");
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* you may not use this file except in compliance with the License.
...
@@ -66,7 +66,7 @@ public class CompositeHealth extends HealthComponent {
...
@@ -66,7 +66,7 @@ public class CompositeHealth extends HealthComponent {
@JsonInclude
(
Include
.
NON_EMPTY
)
@JsonInclude
(
Include
.
NON_EMPTY
)
@JsonProperty
@JsonProperty
Map
<
String
,
HealthComponent
>
getDetails
()
{
public
Map
<
String
,
HealthComponent
>
getDetails
()
{
return
this
.
details
;
return
this
.
details
;
}
}
...
...
spring-boot-project/spring-boot-actuator/src/test/java/org/springframework/boot/actuate/health/CompositeHealthTests.java
View file @
d5264664
/*
/*
* Copyright 2012-202
0
the original author or authors.
* Copyright 2012-202
1
the original author or authors.
*
*
* Licensed under the Apache License, Version 2.0 (the "License");
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* you may not use this file except in compliance with the License.
...
@@ -20,6 +20,7 @@ import java.util.Collections;
...
@@ -20,6 +20,7 @@ import java.util.Collections;
import
java.util.LinkedHashMap
;
import
java.util.LinkedHashMap
;
import
java.util.Map
;
import
java.util.Map
;
import
com.fasterxml.jackson.databind.MapperFeature
;
import
com.fasterxml.jackson.databind.ObjectMapper
;
import
com.fasterxml.jackson.databind.ObjectMapper
;
import
org.junit.jupiter.api.Test
;
import
org.junit.jupiter.api.Test
;
...
@@ -80,4 +81,17 @@ class CompositeHealthTests {
...
@@ -80,4 +81,17 @@ class CompositeHealthTests {
+
"\"db2\":{\"status\":\"DOWN\",\"details\":{\"a\":\"b\"}}}}"
);
+
"\"db2\":{\"status\":\"DOWN\",\"details\":{\"a\":\"b\"}}}}"
);
}
}
@Test
// gh-26797
void
serializeV2WithJacksonAndDisabledCanOverrideAccessModifiersReturnsValidJson
()
throws
Exception
{
Map
<
String
,
HealthComponent
>
components
=
new
LinkedHashMap
<>();
components
.
put
(
"db1"
,
Health
.
up
().
build
());
components
.
put
(
"db2"
,
Health
.
down
().
withDetail
(
"a"
,
"b"
).
build
());
CompositeHealth
health
=
new
CompositeHealth
(
ApiVersion
.
V2
,
Status
.
UP
,
components
);
ObjectMapper
mapper
=
new
ObjectMapper
();
mapper
.
disable
(
MapperFeature
.
CAN_OVERRIDE_ACCESS_MODIFIERS
);
String
json
=
mapper
.
writeValueAsString
(
health
);
assertThat
(
json
).
isEqualTo
(
"{\"status\":\"UP\",\"details\":{\"db1\":{\"status\":\"UP\"},"
+
"\"db2\":{\"status\":\"DOWN\",\"details\":{\"a\":\"b\"}}}}"
);
}
}
}
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