|
|
|
@ -21,6 +21,7 @@ import java.io.IOException;
|
|
|
|
|
import java.net.JarURLConnection;
|
|
|
|
|
import java.net.URL;
|
|
|
|
|
import java.net.URLConnection;
|
|
|
|
|
import java.security.CodeSource;
|
|
|
|
|
import java.util.jar.Attributes;
|
|
|
|
|
import java.util.jar.Attributes.Name;
|
|
|
|
|
import java.util.jar.JarFile;
|
|
|
|
@ -62,8 +63,12 @@ public final class SpringBootVersion {
|
|
|
|
|
if (implementationVersion != null) {
|
|
|
|
|
return implementationVersion;
|
|
|
|
|
}
|
|
|
|
|
URL codeSourceLocation = SpringBootVersion.class.getProtectionDomain()
|
|
|
|
|
.getCodeSource().getLocation();
|
|
|
|
|
CodeSource codeSource = SpringBootVersion.class.getProtectionDomain()
|
|
|
|
|
.getCodeSource();
|
|
|
|
|
if (codeSource == null) {
|
|
|
|
|
return null;
|
|
|
|
|
}
|
|
|
|
|
URL codeSourceLocation = codeSource.getLocation();
|
|
|
|
|
try {
|
|
|
|
|
URLConnection connection = codeSourceLocation.openConnection();
|
|
|
|
|
if (connection instanceof JarURLConnection) {
|
|
|
|
|