Skip to content

Instantly share code, notes, and snippets.

@gregturn
Created February 12, 2014 14:40
Show Gist options
  • Save gregturn/8956690 to your computer and use it in GitHub Desktop.
Save gregturn/8956690 to your computer and use it in GitHub Desktop.
adding extra dump of environment and classloader info
public static void main(String[] args) {
System.getProperties().list(System.out);
for (String key : System.getenv().keySet()) {
System.out.println(key + " => " + System.getenv(key));
}
dumpClassPaths(ApplicationConfiguration.class.getClassLoader());
SpringApplication.run(ApplicationConfiguration.class, args);
}
private static void dumpClassPaths(ClassLoader classLoader) {
System.out.println("Classloader " + classLoader + ":");
if (classLoader instanceof URLClassLoader) {
URLClassLoader urlClassLoader = (URLClassLoader) classLoader;
for (URL url : urlClassLoader.getURLs()) {
System.out.println(url);
}
} else {
System.out.println("Not a URLClassLoader.");
}
if (classLoader.getParent() != null) {
dumpClassPaths(classLoader.getParent());
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment