|
1 | 1 | /*
|
2 |
| - * Copyright 2012-2018 the original author or authors. |
| 2 | + * Copyright 2012-2019 the original author or authors. |
3 | 3 | *
|
4 | 4 | * Licensed under the Apache License, Version 2.0 (the "License");
|
5 | 5 | * you may not use this file except in compliance with the License.
|
|
22 | 22 | import java.net.URL;
|
23 | 23 | import java.net.URLConnection;
|
24 | 24 | import java.util.jar.Attributes;
|
| 25 | +import java.util.jar.Attributes.Name; |
25 | 26 | import java.util.jar.JarFile;
|
26 | 27 |
|
27 | 28 | /**
|
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. |
30 | 34 | * <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. |
35 | 38 | *
|
36 | 39 | * @author Drummond Dawson
|
| 40 | + * @author Hendrig Sellik |
| 41 | + * @author Andy Wilkinson |
37 | 42 | * @since 1.3.0
|
38 | 43 | */
|
39 | 44 | public final class SpringBootVersion {
|
|
0 commit comments