Skip to content

add support for spring boot 4, with a fallback to 3#1226

Open
zakerf wants to merge 1 commit intocloudfoundry:mainfrom
zakerf:spring-boot-4-support
Open

add support for spring boot 4, with a fallback to 3#1226
zakerf wants to merge 1 commit intocloudfoundry:mainfrom
zakerf:spring-boot-4-support

Conversation

@zakerf
Copy link
Copy Markdown

@zakerf zakerf commented Mar 27, 2026

related to #1222

@linux-foundation-easycla
Copy link
Copy Markdown

linux-foundation-easycla bot commented Mar 27, 2026

CLA Signed
The committers listed above are authorized under a signed CLA.

  • ✅ login: zakerf / name: zakerf (ad838f3)

@zakerf zakerf force-pushed the spring-boot-4-support branch from 32072db to ad838f3 Compare March 27, 2026 16:00
source_sha256: 9cc8d4c368bc90eafb7b6b14bc34c57ef5523f3ec8546e3fbd91326cdfc13500
- name: java-cfenv
version: 4.0.0
uri: https://java-buildpack.cloudfoundry.org/java-cfenv/java-cfenv-4.0.0.jar
Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

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

This file is not available at this url but I couldn't find what the process was to get it available there

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

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

Should I prep a PR for that or do you have something in the works for it?

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

The manifest will be populated once we add it to the buildpack dependency config in our overall dependency pipeline

@ramonskie
Copy link
Copy Markdown
Contributor

ramonskie commented Mar 30, 2026

why is a fallback necessary?
as i do not see any breaking changes between 3.5.1 and 4.0.0
pivotal-cf/java-cfenv@v3.5.1...v4.0.0

@stokpop
Copy link
Copy Markdown
Contributor

stokpop commented Mar 31, 2026

@ramonskie I think calls to SpringBoot deps change when going from SpringBoot 3 -> 4, so you I guess you run into runtime "class not found" exceptions: e.g. pivotal-cf/java-cfenv@1dd9ccb

import org.springframework.boot.env.EnvironmentPostProcessor;
<-> 
import org.springframework.boot.EnvironmentPostProcessor;

- name: java-cfenv
- name: java-cfenv-sb3
version: 3.5.0
uri: https://java-buildpack.cloudfoundry.org/java-cfenv/java-cfenv-3.5.0.jar
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

can we also up this to 3.5.1?

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

there is also a bigger problem. and that is that the buildpack is now exceeding the 1gb range. and is now even 1.2gb
so adding more dependencies/version is something we need to be aware off

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Yep, I saw the size was also an issue in the past when Java 21 was added. There is a lot in the "--cached" buildpack.zip indeed. Did a local check and biggest dependencies are your-kit-profiler (137MB) and jprofiler (119MB). Then we have 5 java versions (8,11,17,21,25) in 3 distributions (OpenJDK, Zulu, SAPMachine) for a total of ~596MB. In comparison: the java-cfenv jar is about 872kb. ;-)

Seems off topic here: maybe for another issue/PR: is it possible to create slimmed down versions? E.g. with only one JDK distribution and with/without profilers?

We create a stripped down offline buildpack ourselves with only what we need by removing entries from the manifest.yml file. (One downside: if you then request something not present, e.g. a profiler that is not included, the cf push fails with an unclear error message).

@zakerf
Copy link
Copy Markdown
Author

zakerf commented Mar 31, 2026

@ramonskie the compatibility matrix also mentions that java-cfenv 4.x is for Spring Boot 4 and java-cfenv 3.x is for Spring Boot 3


// Don't enable if java-cfenv is already in the application
if j.hasJavaCfEnv() {
j.context.Log.Debug("java-cfenv already present in application")
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Might be good to log this at info level to avoid confusion wether cf env is available. Nice to have is to also parse the version in hasJavaCfEnv and report the found version.

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.

3 participants