-
Notifications
You must be signed in to change notification settings - Fork 2k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
How to handle Spring + Java 8? #2452
Comments
Hi It is possible to share the base Spring Boot 2 autoconfiguration (assuming you add a text file called I prototyped this to see if it'd work out in practice by building a regular https://github.com/joshlong/hybrid-2-and-3-spring-boot-starters it seems to work. maybe there's a better way, but at least this works. NB:
|
+1 - it should be trivial to support Spring Boot 2 and 3 without a separate jar artifact. At least we should start that way. We could maybe drop Spring Boot 2 when the Kubernetes client reaches a new major, but it's probably not going to be mandatory. UPDATE: ignore the "without a separate artifact" comment - the AOT hints need Spring 6 to compile, so you can only do it in a single artifact if you can use Java 17, and I guess that's not an option for legacy scenarios. I mean, it might be possible to ship both things in one jar. Spring Boot 2 will not go anywhere near the new features, so they could be a different class format I guess. Kind of a hack probably. There is such a thing as a "multiplatform jar" in the JDK though right? I never saw one in the wild. |
The problem has to do with compiling the spring code in this library. (and it's not just about spring boot, it's about spring generally) We're going to target Spring 5.x for now because we need to maintain Java 8 compatability. That means that we can't take a dependency on Spring 6 from this library. Hence the need to split the code so that one library can depend on spring 5 and the other can depend on spring 6. |
right. that's basically what my prototype demonstrates. i wouldn't bifurcate them in terms of spring framework 5 and 6, but instead in terms of the auto configuration (available in all versions of Spring Boot) and the ahead-of-time (AOT) compilation for graalvm (unique to SF 6 / spring boot 3) support. so you'd leave the auto configuration as-is, but add one text file, then you introduce a new jar, which in my prototype I've called SB 3 users could pull in SB 2 users pull in
the contents of I'm happy to craft a new PR to reflect that arrangement if it sounds workable to you. |
@joshlong thanks for the details, it feels like this would be a good approach. Basically if you can craft a PR that passes our integration testing we're good with it :) |
hi - i have just sent this PR. it changes almost nothing from the existing |
@joshlong thank you for the demo project, i've ran it locally and it works like a charm. running the spring3 app which lists
|
The Kubernetes project currently lacks enough contributors to adequately respond to all issues. This bot triages un-triaged issues according to the following rules:
You can:
Please send feedback to sig-contributor-experience at kubernetes/community. /lifecycle stale |
/remove-lifecycle stale (But #2457 is merged, so why is this one still open?) |
The Kubernetes project currently lacks enough contributors to adequately respond to all issues. This bot triages un-triaged issues according to the following rules:
You can:
Please send feedback to sig-contributor-experience at kubernetes/community. /lifecycle stale |
/remove-lifecycle stale |
/lifecycle-frozen |
The Kubernetes project currently lacks enough contributors to adequately respond to all issues. This bot triages un-triaged issues according to the following rules:
You can:
Please send feedback to sig-contributor-experience at kubernetes/community. /lifecycle stale |
The Kubernetes project currently lacks enough active contributors to adequately respond to all issues. This bot triages un-triaged issues according to the following rules:
You can:
Please send feedback to sig-contributor-experience at kubernetes/community. /lifecycle rotten |
/remove-lifecycle stale (But #2457 is merged, so why is this one still open?) Someone should just close this as “fixed”. |
The Kubernetes project currently lacks enough active contributors to adequately respond to all issues and PRs. This bot triages issues according to the following rules:
You can:
Please send feedback to sig-contributor-experience at kubernetes/community. /close not-planned |
@k8s-triage-robot: Closing this issue, marking it as "Not Planned". In response to this:
Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes/test-infra repository. |
Sigh. Dumb robot. If anyone is reading this please be assured that it is fixed. |
Spring has moved to require Java 17 with Spring 6 (https://spring.io/blog/2021/09/02/a-java-17-and-jakarta-ee-9-baseline-for-spring-framework-6)
We probably want to continue to support Java 8 + Spring 5, and this library will keep moving forward with new Kubernetes releases.
So we need to figure out how to move forward here.
I think the best thing to do is probably to extract the code from the
extended
package into a separatespring-6
package which can take a dependency on the new spring code.Note that this is less than ideal because we will have a bunch of code duplication and probably start having feature skew between the two packages.
cc @yue9944882 @joshlong
Does anyone know how other libraries are approaching this?
The text was updated successfully, but these errors were encountered: