1. Check the Logs
Spring Cloud typically logs the release train version during application startup. Look for a log entry similar to this:
2025-01-16 16:49:23.914 INFO [main] - Spring Cloud X.Y.Z (Release Train: <Name>)
In this log:
X.Y.Zis the Spring Cloud version.<Name>refers to the Spring Cloud release train (e.g., "Hoxton", "Greenwich").
2. Enable Debug Logs
To get more details, enable debug logs when starting the application by adding the following argument to your run command:
--debug
This provides a detailed conditions report, including information about the Spring Cloud version.
3. Check pom.xml or build.gradle
Examine the dependency in your build configuration to determine the Spring Cloud version.
Maven (pom.xml)
Search for spring-cloud-dependencies:
<dependencyManagement> <dependencies> <dependency> <groupId>org.springframework.cloud</groupId> <artifactId>spring-cloud-dependencies</artifactId> <version>...</version> <type>pom</type> <scope>import</scope> </dependency> </dependencies> </dependencyManagement>
The <version> tag contains the Spring Cloud release train.
Gradle (build.gradle)
Search for springCloudVersion or dependency declarations:
ext { springCloudVersion = '...' } dependencies { implementation platform("org.springframework.cloud:spring-cloud-dependencies:${springCloudVersion}") }
4. Use the Spring Boot Actuator
If you have the Spring Boot Actuator dependency, you can retrieve version details through the /actuator/info endpoint:
-
Add the
infoendpoint in yourapplication.propertiesorapplication.yml:management.endpoint.info.enabled=true management.endpoints.web.exposure.include=info -
Start the application and access:
http://localhost:8080/actuator/infoThis may include the Spring Cloud version.
5. Use dependency:tree (Maven) or dependencies (Gradle)
Maven:
Run
mvn dependency:tree | grep spring-cloud
This will list all Spring Cloud dependencies and their versions.
Gradle:
Run:
./gradlew dependencies | grep spring-cloud
This will show the dependency versions.
6. Check the META-INF Directory
Inspect the META-INF directory of the packaged JAR file:
- Extract the JAR file:
jar -xf your-app.jar - Check the
META-INF/MANIFEST.MForMETA-INF/spring-boot.propertiesfile for version information.
2352

被折叠的 条评论
为什么被折叠?



