Skip to content

java-cfenv: 5.x drops cloud profile + VCAP property mapping #1349

Description

@stokpop

Summary

Since the Go rewrite, the buildpack injects the bare java-cfenv (core) module. In 4.x it effectively provided java-cfenv-all. The core module has no spring.factories, so apps that rely on the buildpack's java-cfenv no longer get automatic VCAP→Spring property mapping, nor the cloud Spring profile they had before. The change is silent — the app starts fine, just without that configuration.

Impact

Apps upgrading 4.x → 5.x that don't bundle java-cfenv themselves may quietly lose:

  • the cloud profile (so application-cloud.* / @Profile("cloud") config stops loading), and
  • automatic service properties (spring.datasource.*, spring.data.mongodb.uri, RabbitMQ/Redis, etc.).

What we observed

Same app, only the buildpack differs:

4.x:  The following 1 profile is active: "cloud"
      i.p.c.p.CloudProfileApplicationListener : 'cloud' profile activated
5.x:  No active profile set, falling back to 1 default profile: "local"

The injected jars confirm it:

  • 4.x container → jar contains io.pivotal.cfenv.profile.CloudProfileApplicationListenerjava-cfenv-all.
  • 5.x container → core classes only, no spring.factories → bare java-cfenv.

The cloud profile listener lives only in java-cfenv-all, which explains the difference.

The migration guide still recommends java-cfenv-boot and describes the cloud profile as active on CF, which suggests this artifact change was unintended rather than a deliberate behavior change.

Suggested fix

Point the java-cfenv dependency at java-cfenv-all (version-matched to the app's Spring Boot major — 3.5.1 for SB3, 4.0.0 for SB4), restoring 4.x behavior with no action needed from apps. This touches manifest.yml (source/uri, plus the version-match regex, which won't match a java-cfenv-all-* filename as-is).

Note — a small related manifest item

The mirrored java-cfenv 3.5.1 and 4.0.0 entries currently share the same uri/sha256 (and source_sha256 is empty), so both resolve to the same file. Re-mirroring java-cfenv-all for both versions would be a good moment to refresh these too.

Workaround for app teams

Add java-cfenv-all explicitly (matched to your Spring Boot version):

<dependency>
  <groupId>io.pivotal.cfenv</groupId>
  <artifactId>java-cfenv-all</artifactId>
  <version>4.0.0</version>
</dependency>

or set the profile directly: cf set-env <APP> SPRING_PROFILES_ACTIVE cloud && cf restage <APP>.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Fields

    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions