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
24471bc5
Commit
24471bc5
authored
Jun 16, 2014
by
Phillip Webb
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Polish
parent
299311d7
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
21 additions
and
14 deletions
+21
-14
EnvironmentEndpoint.java
...gframework/boot/actuate/endpoint/EnvironmentEndpoint.java
+17
-13
EndpointMvcIntegrationTests.java
...ot/actuate/autoconfigure/EndpointMvcIntegrationTests.java
+4
-1
No files found.
spring-boot-actuator/src/main/java/org/springframework/boot/actuate/endpoint/EnvironmentEndpoint.java
View file @
24471bc5
...
...
@@ -17,6 +17,7 @@
package
org
.
springframework
.
boot
.
actuate
.
endpoint
;
import
java.lang.reflect.Field
;
import
java.util.Collections
;
import
java.util.LinkedHashMap
;
import
java.util.Map
;
import
java.util.Map.Entry
;
...
...
@@ -99,19 +100,9 @@ public class EnvironmentEndpoint extends AbstractEndpoint<Map<String, Object>> i
private
void
extract
(
String
root
,
Map
<
String
,
PropertySource
<?>>
map
,
PropertySource
<?>
source
)
{
if
(
source
instanceof
CompositePropertySource
)
{
try
{
Field
field
=
ReflectionUtils
.
findField
(
CompositePropertySource
.
class
,
"propertySources"
);
field
.
setAccessible
(
true
);
@SuppressWarnings
(
"unchecked"
)
Set
<
PropertySource
<?>>
nested
=
(
Set
<
PropertySource
<?>>)
field
.
get
(
source
);
for
(
PropertySource
<?>
nest
:
nested
)
{
extract
(
source
.
getName
()
+
":"
,
map
,
nest
);
}
}
catch
(
Exception
e
)
{
// ignore
Set
<
PropertySource
<?>>
nested
=
getNestedPropertySources
((
CompositePropertySource
)
source
);
for
(
PropertySource
<?>
nest
:
nested
)
{
extract
(
source
.
getName
()
+
":"
,
map
,
nest
);
}
}
else
{
...
...
@@ -119,6 +110,19 @@ public class EnvironmentEndpoint extends AbstractEndpoint<Map<String, Object>> i
}
}
@SuppressWarnings
(
"unchecked"
)
private
Set
<
PropertySource
<?>>
getNestedPropertySources
(
CompositePropertySource
source
)
{
try
{
Field
field
=
ReflectionUtils
.
findField
(
CompositePropertySource
.
class
,
"propertySources"
);
field
.
setAccessible
(
true
);
return
(
Set
<
PropertySource
<?>>)
field
.
get
(
source
);
}
catch
(
Exception
ex
)
{
return
Collections
.
emptySet
();
}
}
public
Object
sanitize
(
String
name
,
Object
object
)
{
for
(
String
keyToSanitize
:
this
.
keysToSanitize
)
{
if
(
name
.
toLowerCase
().
endsWith
(
keyToSanitize
))
{
...
...
spring-boot-actuator/src/test/java/org/springframework/boot/actuate/autoconfigure/EndpointMvcIntegrationTests.java
View file @
24471bc5
/*
* Copyright 2012-201
3
the original author or authors.
* Copyright 2012-201
4
the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
...
...
@@ -28,6 +28,7 @@ import org.junit.Test;
import
org.junit.runner.RunWith
;
import
org.springframework.beans.factory.annotation.Value
;
import
org.springframework.boot.actuate.autoconfigure.EndpointMvcIntegrationTests.Application
;
import
org.springframework.boot.actuate.endpoint.Endpoint
;
import
org.springframework.boot.autoconfigure.PropertyPlaceholderAutoConfiguration
;
import
org.springframework.boot.autoconfigure.web.DispatcherServletAutoConfiguration
;
import
org.springframework.boot.autoconfigure.web.EmbeddedServletContainerAutoConfiguration
;
...
...
@@ -51,6 +52,8 @@ import static org.junit.Assert.assertNotNull;
import
static
org
.
junit
.
Assert
.
assertTrue
;
/**
* Integration tests for MVC {@link Endpoint}s.
*
* @author Dave Syer
*/
@RunWith
(
SpringJUnit4ClassRunner
.
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