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
efe84356
Commit
efe84356
authored
Jun 23, 2020
by
Phillip Webb
Browse files
Options
Browse Files
Download
Plain Diff
Merge branch '2.3.x'
Closes gh-22064
parents
301ec12a
03b0a373
Changes
3
Show whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
44 additions
and
14 deletions
+44
-14
HealthEndpointProperties.java
...ctuate/autoconfigure/health/HealthEndpointProperties.java
+31
-1
HealthProperties.java
...k/boot/actuate/autoconfigure/health/HealthProperties.java
+2
-13
AutoConfiguredHealthEndpointGroupsTests.java
...igure/health/AutoConfiguredHealthEndpointGroupsTests.java
+11
-0
No files found.
spring-boot-project/spring-boot-actuator-autoconfigure/src/main/java/org/springframework/boot/actuate/autoconfigure/health/HealthEndpointProperties.java
View file @
efe84356
/*
/*
* Copyright 2012-20
19
the original author or authors.
* Copyright 2012-20
20
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.
...
@@ -27,16 +27,31 @@ import org.springframework.boot.context.properties.ConfigurationProperties;
...
@@ -27,16 +27,31 @@ import org.springframework.boot.context.properties.ConfigurationProperties;
* Configuration properties for {@link HealthEndpoint}.
* Configuration properties for {@link HealthEndpoint}.
*
*
* @author Phillip Webb
* @author Phillip Webb
* @author Leo Li
* @since 2.0.0
* @since 2.0.0
*/
*/
@ConfigurationProperties
(
"management.endpoint.health"
)
@ConfigurationProperties
(
"management.endpoint.health"
)
public
class
HealthEndpointProperties
extends
HealthProperties
{
public
class
HealthEndpointProperties
extends
HealthProperties
{
/**
* When to show full health details.
*/
private
Show
showDetails
=
Show
.
NEVER
;
/**
/**
* Health endpoint groups.
* Health endpoint groups.
*/
*/
private
Map
<
String
,
Group
>
group
=
new
LinkedHashMap
<>();
private
Map
<
String
,
Group
>
group
=
new
LinkedHashMap
<>();
@Override
public
Show
getShowDetails
()
{
return
this
.
showDetails
;
}
public
void
setShowDetails
(
Show
showDetails
)
{
this
.
showDetails
=
showDetails
;
}
public
Map
<
String
,
Group
>
getGroup
()
{
public
Map
<
String
,
Group
>
getGroup
()
{
return
this
.
group
;
return
this
.
group
;
}
}
...
@@ -56,6 +71,12 @@ public class HealthEndpointProperties extends HealthProperties {
...
@@ -56,6 +71,12 @@ public class HealthEndpointProperties extends HealthProperties {
*/
*/
private
Set
<
String
>
exclude
;
private
Set
<
String
>
exclude
;
/**
* When to show full health details. Defaults to the value of
* 'management.endpoint.health.show-details'.
*/
private
Show
showDetails
;
public
Set
<
String
>
getInclude
()
{
public
Set
<
String
>
getInclude
()
{
return
this
.
include
;
return
this
.
include
;
}
}
...
@@ -72,6 +93,15 @@ public class HealthEndpointProperties extends HealthProperties {
...
@@ -72,6 +93,15 @@ public class HealthEndpointProperties extends HealthProperties {
this
.
exclude
=
exclude
;
this
.
exclude
=
exclude
;
}
}
@Override
public
Show
getShowDetails
()
{
return
this
.
showDetails
;
}
public
void
setShowDetails
(
Show
showDetails
)
{
this
.
showDetails
=
showDetails
;
}
}
}
}
}
spring-boot-project/spring-boot-actuator-autoconfigure/src/main/java/org/springframework/boot/actuate/autoconfigure/health/HealthProperties.java
View file @
efe84356
/*
/*
* Copyright 2012-20
19
the original author or authors.
* Copyright 2012-20
20
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.
...
@@ -43,11 +43,6 @@ public abstract class HealthProperties {
...
@@ -43,11 +43,6 @@ public abstract class HealthProperties {
*/
*/
private
Show
showComponents
;
private
Show
showComponents
;
/**
* When to show full health details.
*/
private
Show
showDetails
=
Show
.
NEVER
;
/**
/**
* Roles used to determine whether or not a user is authorized to be shown details.
* Roles used to determine whether or not a user is authorized to be shown details.
* When empty, all authenticated users are authorized.
* When empty, all authenticated users are authorized.
...
@@ -66,13 +61,7 @@ public abstract class HealthProperties {
...
@@ -66,13 +61,7 @@ public abstract class HealthProperties {
this
.
showComponents
=
showComponents
;
this
.
showComponents
=
showComponents
;
}
}
public
Show
getShowDetails
()
{
public
abstract
Show
getShowDetails
();
return
this
.
showDetails
;
}
public
void
setShowDetails
(
Show
showDetails
)
{
this
.
showDetails
=
showDetails
;
}
public
Set
<
String
>
getRoles
()
{
public
Set
<
String
>
getRoles
()
{
return
this
.
roles
;
return
this
.
roles
;
...
...
spring-boot-project/spring-boot-actuator-autoconfigure/src/test/java/org/springframework/boot/actuate/autoconfigure/health/AutoConfiguredHealthEndpointGroupsTests.java
View file @
efe84356
...
@@ -43,6 +43,7 @@ import static org.assertj.core.api.Assertions.assertThat;
...
@@ -43,6 +43,7 @@ import static org.assertj.core.api.Assertions.assertThat;
* Tests for {@link AutoConfiguredHealthEndpointGroups}.
* Tests for {@link AutoConfiguredHealthEndpointGroups}.
*
*
* @author Phillip Webb
* @author Phillip Webb
* @author Leo Li
*/
*/
class
AutoConfiguredHealthEndpointGroupsTests
{
class
AutoConfiguredHealthEndpointGroupsTests
{
...
@@ -308,6 +309,16 @@ class AutoConfiguredHealthEndpointGroupsTests {
...
@@ -308,6 +309,16 @@ class AutoConfiguredHealthEndpointGroupsTests {
});
});
}
}
@Test
void
createWhenGroupWithNoShowDetailsOverrideInheritsShowDetails
()
{
this
.
contextRunner
.
withPropertyValues
(
"management.endpoint.health.show-details=always"
,
"management.endpoint.health.group.a.include=*"
).
run
((
context
)
->
{
HealthEndpointGroups
groups
=
context
.
getBean
(
HealthEndpointGroups
.
class
);
HealthEndpointGroup
groupA
=
groups
.
get
(
"a"
);
assertThat
(
groupA
.
showDetails
(
SecurityContext
.
NONE
)).
isTrue
();
});
}
@Configuration
(
proxyBeanMethods
=
false
)
@Configuration
(
proxyBeanMethods
=
false
)
@EnableConfigurationProperties
(
HealthEndpointProperties
.
class
)
@EnableConfigurationProperties
(
HealthEndpointProperties
.
class
)
static
class
AutoConfiguredHealthEndpointGroupsTestConfiguration
{
static
class
AutoConfiguredHealthEndpointGroupsTestConfiguration
{
...
...
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