;Autowired
private StandardServletEnvironment standardServletEnvironment;
HashMap<String,Object> hashMap = new HashMap<>();
MutablePropertySources propertySources = standardServletEnvironment.getPropertySources();
Iterator<PropertySource<?>> iterator = propertySources.iterator();
while(iterator.hasNext()) {
PropertySource<?> next = iterator.next();
if(next instanceof OriginTrackedMapPropertySource) {
OriginTrackedMapPropertySource originTrackedMapPropertySource=(OriginTrackedMapPropertySource) next;
Map<String, Object> source = originTrackedMapPropertySource.getSource();
for (Map.Entry<String,Object> entry:source.entrySet()){
hashMap.put(entry.getKey(), entry.getValue().toString());
}
}
}