Showing how to use PropertySource which is an abstract class. The property source which has a name and a source of key/value pairs could be system, environmental or application provided properties.
private static void printSources (ConfigurableEnvironment env) {
System.out.println("-- property sources --");
for (PropertySource<?> propertySource : env.getPropertySources()) {
System.out.println("name = " + propertySource.getName() + "\nsource = " + propertySource
.getSource().getClass()+"\n");
}
}
Original Post