apple / pkl

A configuration as code language with rich validation and tooling.
https://pkl-lang.org
Apache License 2.0
10.33k stars 278 forks source link

Support for Spring Boot 3 ConstructorBinding annotation #139

Closed namhptran closed 2 weeks ago

namhptran commented 9 months ago

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

namhptran commented 9 months ago

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

bioball commented 9 months ago

Makes sense!

translatenix commented 3 weeks ago

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

translatenix commented 2 weeks ago

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

@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

bioball commented 2 weeks ago

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?

translatenix commented 2 weeks ago

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.)

stackoverflow commented 2 weeks ago

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.

holzensp commented 2 weeks ago

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)

translatenix commented 2 weeks ago

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