Skip to content

Commit 6d0b71d

Browse files
committed
docs(cf-env): migration guide should use java-cfenv-all
The main migration steps recommended java-cfenv-boot 3.1.4, which does not carry CloudProfileApplicationListener and so drops the `cloud` profile -- contradicting the guide's own notes. Switch the pom/gradle snippets and checklist to java-cfenv-all, version-matched to the app's Spring Boot major (3.5.1 for 3.x, 4.0.0 for 4.x), and note java-cfenv-boot as the lighter option for apps that do not need the `cloud` profile. Refs #1349.
1 parent 6e341b9 commit 6d0b71d

1 file changed

Lines changed: 16 additions & 14 deletions

File tree

docs/spring-auto-reconfiguration-migration.md

Lines changed: 16 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -70,8 +70,9 @@ This guide provides step-by-step instructions for migrating from the deprecated
7070
<!-- Add to your pom.xml -->
7171
<dependency>
7272
<groupId>io.pivotal.cfenv</groupId>
73-
<artifactId>java-cfenv-boot</artifactId>
74-
<version>3.1.4</version>
73+
<artifactId>java-cfenv-all</artifactId>
74+
<!-- match your Spring Boot major: 3.5.1 for Spring Boot 3, 4.0.0 for Spring Boot 4 -->
75+
<version>3.5.1</version>
7576
</dependency>
7677
```
7778
@@ -80,6 +81,7 @@ This guide provides step-by-step instructions for migrating from the deprecated
8081
- Library reads `VCAP_SERVICES` and sets Spring Boot properties
8182
- Spring Boot autoconfiguration uses these properties
8283
- More transparent and Spring Boot native
84+
- `java-cfenv-all` bundles the property post-processors **and** the `cloud` profile listener (`CloudProfileApplicationListener`); use the lighter `java-cfenv-boot` instead only if you do not rely on the `cloud` profile
8385
8486
---
8587
@@ -109,11 +111,11 @@ Check your `pom.xml` or `build.gradle`:
109111
110112
```xml
111113
<dependencies>
112-
<!-- Add this dependency -->
114+
<!-- Add this dependency (match your Spring Boot major: 3.5.1 for Spring Boot 3, 4.0.0 for Spring Boot 4) -->
113115
<dependency>
114116
<groupId>io.pivotal.cfenv</groupId>
115-
<artifactId>java-cfenv-boot</artifactId>
116-
<version>3.1.4</version>
117+
<artifactId>java-cfenv-all</artifactId>
118+
<version>3.5.1</version>
117119
</dependency>
118120
</dependencies>
119121
```
@@ -122,7 +124,7 @@ Check your `pom.xml` or `build.gradle`:
122124
123125
```groovy
124126
dependencies {
125-
implementation 'io.pivotal.cfenv:java-cfenv-boot:3.1.4'
127+
implementation 'io.pivotal.cfenv:java-cfenv-all:3.5.1' // 4.0.0 for Spring Boot 4
126128
}
127129
```
128130
@@ -245,7 +247,7 @@ You should see:
245247
```
246248
Java Buildpack v1.x.x | https://github.com/cloudfoundry/java-buildpack
247249
-----> Supplying frameworks...
248-
java-cf-env=3.1.4
250+
java-cf-env=3.5.1
249251
```
250252
251253
---
@@ -472,13 +474,13 @@ public class CustomConfig {
472474
### Issue: "cloud" profile not active
473475
474476
**Cause**: The `cloud` profile is activated by `CloudProfileApplicationListener`, which ships
475-
only in the `java-cfenv-all` module. The `java-cfenv-boot` dependency shown above does **not**
476-
activate it. If you previously depended on the `cloud` profile under Spring Auto-reconfiguration,
477-
it will not be active after migrating to `java-cfenv-boot` alone.
477+
only in the `java-cfenv-all` module. If you migrated with the lighter `java-cfenv-boot` module
478+
instead, it does **not** carry that listener, so the `cloud` profile you had under Spring
479+
Auto-reconfiguration will not be active.
478480
479-
**Solution**: Either depend on `java-cfenv-all` instead of `java-cfenv-boot`, or activate the
480-
profile explicitly. If the application already sets other active profiles, add `cloud` alongside
481-
them with `SPRING_PROFILES_INCLUDE`:
481+
**Solution**: Depend on `java-cfenv-all` (as shown in the steps above), or activate the profile
482+
explicitly. If the application already sets other active profiles, add `cloud` alongside them with
483+
`SPRING_PROFILES_INCLUDE`:
482484
483485
```bash
484486
cf set-env <APP> SPRING_PROFILES_INCLUDE cloud # adds 'cloud' to any existing profiles
@@ -527,7 +529,7 @@ If you encounter migration issues:
527529
## Summary Checklist
528530
529531
- [ ] Verify Spring Boot version (2.1+ required, 3.x recommended)
530-
- [ ] Add `java-cfenv-boot` dependency to `pom.xml` or `build.gradle`
532+
- [ ] Add `java-cfenv-all` dependency to `pom.xml` or `build.gradle` (match your Spring Boot major)
531533
- [ ] Remove Spring Cloud Connectors dependencies (if present)
532534
- [ ] Review and simplify custom service configurations
533535
- [ ] Remove `JBP_CONFIG_SPRING_AUTO_RECONFIGURATION` environment variable

0 commit comments

Comments
 (0)