Support for Spring Boot 3 ConstructorBinding annotation #58

Closed
opened 2025-12-30 01:20:12 +01:00 by adam · 9 comments
Owner

Originally created by @namhptran on GitHub (Feb 13, 2024).

a28ef85698/pkl-codegen-java/src/main/kotlin/org/pkl/codegen/java/JavaCodeGenerator.kt (L494)

Currently Java Code Generator with Spring Boot Configurations generates classes with annotation org.springframework.boot.context.properties.ConstructorBinding.

This was deprecated in Spring Boot 3.0.0 and as of Spring Boot 3.2.0 this has been removed in favour of org.springframework.boot.context.properties.bind.ConstructorBinding.

https://docs.spring.io/spring-boot/docs/3.0.0/api/org/springframework/boot/context/properties/ConstructorBinding.html

Originally created by @namhptran on GitHub (Feb 13, 2024). https://github.com/apple/pkl/blob/a28ef856981d44b861eb6a16ab9bdf23adacf604/pkl-codegen-java/src/main/kotlin/org/pkl/codegen/java/JavaCodeGenerator.kt#L494 Currently Java Code Generator with Spring Boot Configurations generates classes with annotation `org.springframework.boot.context.properties.ConstructorBinding`. This was deprecated in Spring Boot 3.0.0 and as of Spring Boot 3.2.0 this has been removed in favour of `org.springframework.boot.context.properties.bind.ConstructorBinding`. https://docs.spring.io/spring-boot/docs/3.0.0/api/org/springframework/boot/context/properties/ConstructorBinding.html
adam closed this issue 2025-12-30 01:20:12 +01:00
Author
Owner

@namhptran commented on GitHub (Feb 13, 2024):

To add, while Spring Boot 2 supports both class level annotation and constructor level annotation, Spring Boot 3 requires Constructor level annotation (which optionally can also be omitted). Currently it adds to the Class with no option for adding to the Constructor instead.

I think there needs to be an option to exclude this annotation if using Spring Boot 3

@namhptran commented on GitHub (Feb 13, 2024): To add, while Spring Boot 2 supports both class level annotation and constructor level annotation, Spring Boot 3 requires Constructor level annotation (which optionally can also be omitted). Currently it adds to the Class with no option for adding to the Constructor instead. I think there needs to be an option to exclude this annotation if using Spring Boot 3
Author
Owner

@bioball commented on GitHub (Feb 14, 2024):

Makes sense!

@bioball commented on GitHub (Feb 14, 2024): Makes sense!
Author
Owner

@odenix commented on GitHub (Oct 18, 2024):

@bioball Do both versions need to be supported, or is Boot 3 good enough?

@odenix commented on GitHub (Oct 18, 2024): @bioball Do both versions need to be supported, or is Boot 3 good enough?
Author
Owner

@odenix commented on GitHub (Oct 22, 2024):

Supporting multiple Spring Boot versions will, at a minimum, require to

  • add a springBootVersion property to CliJavaCodeGeneratorOptions, CliKotlinCodeGeneratorOptions, JavaCodeGenerator, KotlinCodeGenerator, and CodeGenSpec (Gradle plugin).
  • improve pkl-spring tests to test against multiple String Boot versions.

@bioball I'd like to send a PR in time for 0.27 but first need a decision. (I don't really mind, I just want to fix the problem.)

PS: Spring Boot seems to follow a tip and tail release model much like the JDK. OSS support for 2.x ended a year ago. Enterprise support for 2.x ends 12/2026. https://spring.io/projects/spring-boot#support

@odenix commented on GitHub (Oct 22, 2024): Supporting multiple Spring Boot versions will, at a minimum, require to * add a `springBootVersion` property to `CliJavaCodeGeneratorOptions`, `CliKotlinCodeGeneratorOptions`, `JavaCodeGenerator`, `KotlinCodeGenerator`, and `CodeGenSpec` (Gradle plugin). * improve pkl-spring tests to test against multiple String Boot versions. @bioball I'd like to send a PR in time for 0.27 but first need a decision. (I don't really mind, I just want to fix the problem.) PS: Spring Boot seems to follow a [tip and tail](https://openjdk.org/jeps/14) release model much like the JDK. OSS support for 2.x ended a year ago. Enterprise support for 2.x ends 12/2026. https://spring.io/projects/spring-boot#support
Author
Owner

@bioball commented on GitHub (Oct 22, 2024):

I don't really have a strong opinion here. @holzensp or @stackoverflow, any thoughts?

@translatenix what's your opinion? Should Pkl remove Spring Boot 2 support?

@bioball commented on GitHub (Oct 22, 2024): I don't really have a strong opinion here. @holzensp or @stackoverflow, any thoughts? @translatenix what's your opinion? Should Pkl remove Spring Boot 2 support?
Author
Owner

@odenix commented on GitHub (Oct 22, 2024):

As OSS support for Boot 2.x ended a year ago and Pkl is cutting edge (0.x), I’m inclined to drop Boot 2.x support unless you have internal users that can neither update to Boot 3.x nor stay on Pkl 0.26. (Probably they’d just need to stay on the 0.26 code generator.)

@odenix commented on GitHub (Oct 22, 2024): As OSS support for Boot 2.x ended a year ago and Pkl is cutting edge (0.x), I’m inclined to drop Boot 2.x support unless you have internal users that can neither update to Boot 3.x nor stay on Pkl 0.26. (Probably they’d just need to stay on the 0.26 code generator.)
Author
Owner

@stackoverflow commented on GitHub (Oct 23, 2024):

Agree that we can drop support for Boot 2.x. We dropped support for unmaintained Java versions, so it's in line to do the same with Spring.

@stackoverflow commented on GitHub (Oct 23, 2024): Agree that we can drop support for Boot 2.x. We dropped support for unmaintained Java versions, so it's in line to do the same with Spring.
Author
Owner

@holzensp commented on GitHub (Oct 24, 2024):

Enterprise support is running until 2027, but I agree; if folks can't bump their Spring, they'll likely also be fine staying on 0.26 (codegen)

@holzensp commented on GitHub (Oct 24, 2024): Enterprise support is running until 2027, but I agree; if folks can't bump their Spring, they'll likely also be fine staying on 0.26 (codegen)
Author
Owner

@odenix commented on GitHub (Oct 24, 2024):

Enterprise support is running until 2027

From the support page I linked to:

Branch Initial Release End of OSS Support End of Enterprise Support
3.0.x 2022-11-24 2023-11-24 2025-02-24
2.7.x 2022-05-19 2023-11-24 2026-12-31
@odenix commented on GitHub (Oct 24, 2024): > Enterprise support is running until 2027 From the support page I linked to: Branch| Initial Release | End of OSS Support | End of Enterprise Support -- | -- | -- | -- 3.0.x | 2022-11-24 | 2023-11-24 | 2025-02-24 2.7.x | 2022-05-19 | 2023-11-24 | 2026-12-31
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: starred/pkl#58