Hey guys I have been trying to determine which properties in Spring boot were configured by users vs. spring auto-configuration. I am able to list all properties, but I am not certain how to just get the properties declared by the user.
//This method gets all properties in the Spring environment
public Properties getSpringEnvironmentProperties() {
Properties props = new Properties();
MutablePropertySources propSrcs = ((AbstractEnvironment) env).getPropertySources();
StreamSupport.stream(propSrcs.spliterator(), false)
.filter(ps -> ps instanceof EnumerablePropertySource)
.map(ps -> ((EnumerablePropertySource) ps).getPropertyNames())
.flatMap(Arrays::<String>stream)
.forEach(propName -> props.setProperty(propName, env.getProperty(propName)));
return props;
}
Is there any way to only get properties that are user declared in files like: application.properties?