Skip to content

Commit 15f28dc

Browse files
committed
Polish "Determine Spring Boot version correctly when using module path"
See gh-16182
1 parent ec8fb61 commit 15f28dc

File tree

1 file changed

+12
-7
lines changed

1 file changed

+12
-7
lines changed

spring-boot-project/spring-boot/src/main/java/org/springframework/boot/SpringBootVersion.java

Lines changed: 12 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* Copyright 2012-2018 the original author or authors.
2+
* Copyright 2012-2019 the original author or authors.
33
*
44
* Licensed under the Apache License, Version 2.0 (the "License");
55
* you may not use this file except in compliance with the License.
@@ -22,18 +22,23 @@
2222
import java.net.URL;
2323
import java.net.URLConnection;
2424
import java.util.jar.Attributes;
25+
import java.util.jar.Attributes.Name;
2526
import java.util.jar.JarFile;
2627

2728
/**
28-
* Class that exposes the Spring Boot version. Fetches the "Implementation-Version"
29-
* manifest attribute from the jar file.
29+
* Class that exposes the Spring Boot version. Fetches the
30+
* {@link Name#IMPLEMENTATION_VERSION Implementation-Version} manifest attribute from the
31+
* jar file via {@link Package#getImplementationVersion()}, falling back to locating the
32+
* jar file that contains this class and reading the {@code Implementation-Version}
33+
* attribute from its manifest.
3034
* <p>
31-
* Note that some ClassLoaders do not expose the package metadata, hence this class might
32-
* not be able to determine the Spring Boot version in all environments. Consider using a
33-
* reflection-based check instead: For example, checking for the presence of a specific
34-
* Spring Boot method that you intend to call.
35+
* This class might not be able to determine the Spring Boot version in all environments.
36+
* Consider using a reflection-based check instead: For example, checking for the presence
37+
* of a specific Spring Boot method that you intend to call.
3538
*
3639
* @author Drummond Dawson
40+
* @author Hendrig Sellik
41+
* @author Andy Wilkinson
3742
* @since 1.3.0
3843
*/
3944
public final class SpringBootVersion {

0 commit comments

Comments
 (0)