Skip to content

fix(java-cfenv): ship java-cfenv-all so the cloud profile is applied#1352

Open
stokpop wants to merge 1 commit into
cloudfoundry:mainfrom
stokpop:fix/java-cfenv-all-cloud-profile
Open

fix(java-cfenv): ship java-cfenv-all so the cloud profile is applied#1352
stokpop wants to merge 1 commit into
cloudfoundry:mainfrom
stokpop:fix/java-cfenv-all-cloud-profile

Conversation

@stokpop

@stokpop stokpop commented Jul 8, 2026

Copy link
Copy Markdown
Contributor

Summary

Since the Go rewrite, the buildpack injects the bare java-cfenv core module. 4.x effectively shipped java-cfenv-all. The core module has no META-INF/spring.factories, no EnvironmentPostProcessor, and no CloudProfileApplicationListener, so apps relying on the buildpack's java-cfenv silently lose the cloud Spring profile and automatic VCAP_SERVICES → Spring property mapping they had under 4.x. The app starts fine, just without that configuration.

Fixes #1349.

Changes

  • manifest.yml: point the java-cfenv 3.5.1 and 4.0.0 dependencies at the java-cfenv-all artifact, with per-version sha256/source_sha256. This also fixes the two entries previously sharing one mirror object (identical uri/sha256, empty source_sha256).
  • manifest.yml: update url_to_dependency_map to java-cfenv-all-(\d+\.\d+\.\d+).
  • Add a network-gated artifact test (//go:build cfenv_artifact) that downloads each shipped jar, verifies its sha256, and asserts spring.factories registers io.pivotal.cfenv.profile.CloudProfileApplicationListener.

No framework code change is needed: resolution keys on the manifest name/version, and the hyphenated java-cfenv-all-<ver>.jar name matches the existing Finalize classpath glob (java-cfenv-*.jar).

Verification

  • java-cfenv-all-3.5.1.jar is byte-identical to the 4.x Ruby-era mirror (java-buildpack.cloudfoundry.org/java-cfenv/java-cfenv-3.5.1.jar), sha256 696225e3…736a1 — so this restores the exact artifact 4.x shipped. Hashes were verified against Maven Central's published .sha1.
  • go test ./... unchanged (offline; the networked test is tag-excluded).
  • go test -tags cfenv_artifact ./src/java/frameworks/: RED on the previous core manifest (no spring.factories), GREEN after this change for both 3.5.1 and 4.0.0.

Note on the artifact source

The uri points directly at Maven Central as an interim, so the fix is self-contained and CI-verifiable now. The convention-correct source is the CF mirror (buildpacks.cloudfoundry.org); the mirror pipeline currently mirrors the wrong Maven artifact_id (java-cfenv core). A companion buildpacks-ci change (artifact_id: java-cfenvjava-cfenv-all) will re-mirror the aggregate; once it lands, uri can move to the CF host — a no-risk swap since the bytes are identical.

The buildpack injected the bare `java-cfenv` core module, which has no
META-INF/spring.factories and no CloudProfileApplicationListener. As a
result the `cloud` Spring profile and automatic VCAP property mapping
were silently dropped versus 4.x, which shipped `java-cfenv-all`.

Point the java-cfenv 3.5.1 and 4.0.0 dependencies at the java-cfenv-all
artifact (Maven Central), with per-version sha256 verified against the
published .sha1 -- this also fixes the two entries previously sharing a
single mirror object. Update url_to_dependency_map for the
java-cfenv-all-* filename. No framework code change is needed: resolution
keys on the manifest name/version, and the hyphenated jar name matches the
Finalize classpath glob.

Add a network-gated artifact test (build tag cfenv_artifact) that
downloads each shipped jar, verifies its sha256, and asserts
spring.factories registers CloudProfileApplicationListener.

Refs cloudfoundry#1349.

@rkoster rkoster left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I would like it better if the existing spring boot test would be extended to actually confirm environment variables are being parsed by the app in: https://github.com/cloudfoundry/java-buildpack/blob/main/src/integration/spring_boot_test.go

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

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

2 participants