|
|
@ -16,12 +16,9 @@
|
|
|
|
|
|
|
|
|
|
|
|
package org.springframework.boot.actuate.endpoint;
|
|
|
|
package org.springframework.boot.actuate.endpoint;
|
|
|
|
|
|
|
|
|
|
|
|
import java.lang.reflect.Field;
|
|
|
|
|
|
|
|
import java.util.Collections;
|
|
|
|
|
|
|
|
import java.util.LinkedHashMap;
|
|
|
|
import java.util.LinkedHashMap;
|
|
|
|
import java.util.Map;
|
|
|
|
import java.util.Map;
|
|
|
|
import java.util.Map.Entry;
|
|
|
|
import java.util.Map.Entry;
|
|
|
|
import java.util.Set;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
import org.springframework.boot.context.properties.ConfigurationProperties;
|
|
|
|
import org.springframework.boot.context.properties.ConfigurationProperties;
|
|
|
|
import org.springframework.context.EnvironmentAware;
|
|
|
|
import org.springframework.context.EnvironmentAware;
|
|
|
@ -32,7 +29,6 @@ import org.springframework.core.env.Environment;
|
|
|
|
import org.springframework.core.env.MutablePropertySources;
|
|
|
|
import org.springframework.core.env.MutablePropertySources;
|
|
|
|
import org.springframework.core.env.PropertySource;
|
|
|
|
import org.springframework.core.env.PropertySource;
|
|
|
|
import org.springframework.core.env.StandardEnvironment;
|
|
|
|
import org.springframework.core.env.StandardEnvironment;
|
|
|
|
import org.springframework.util.ReflectionUtils;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
/**
|
|
|
|
* {@link Endpoint} to expose {@link ConfigurableEnvironment environment} information.
|
|
|
|
* {@link Endpoint} to expose {@link ConfigurableEnvironment environment} information.
|
|
|
@ -98,8 +94,8 @@ public class EnvironmentEndpoint extends AbstractEndpoint<Map<String, Object>> i
|
|
|
|
private void extract(String root, Map<String, PropertySource<?>> map,
|
|
|
|
private void extract(String root, Map<String, PropertySource<?>> map,
|
|
|
|
PropertySource<?> source) {
|
|
|
|
PropertySource<?> source) {
|
|
|
|
if (source instanceof CompositePropertySource) {
|
|
|
|
if (source instanceof CompositePropertySource) {
|
|
|
|
Set<PropertySource<?>> nested = getNestedPropertySources((CompositePropertySource) source);
|
|
|
|
for (PropertySource<?> nest : ((CompositePropertySource) source)
|
|
|
|
for (PropertySource<?> nest : nested) {
|
|
|
|
.getPropertySources()) {
|
|
|
|
extract(source.getName() + ":", map, nest);
|
|
|
|
extract(source.getName() + ":", map, nest);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
@ -108,19 +104,6 @@ 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) {
|
|
|
|
public Object sanitize(String name, Object object) {
|
|
|
|
return this.sanitizer.sanitize(name, object);
|
|
|
|
return this.sanitizer.sanitize(name, object);
|
|
|
|
}
|
|
|
|
}
|
|
|
|