Created
September 7, 2022 10:53
-
-
Save rbaul/76b322b18705429899d440e6eb2b2f5a to your computer and use it in GitHub Desktop.
Get all environment in Spring Boot Application
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Map<String, Object> map = new HashMap(); | |
for(Iterator it = ((AbstractEnvironment) env).getPropertySources().iterator(); it.hasNext(); ) { | |
PropertySource propertySource = (PropertySource) it.next(); | |
if (propertySource instanceof MapPropertySource) { | |
map.putAll(((MapPropertySource) propertySource).getSource()); | |
} | |
} | |
return map; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment