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
Kotlin extension for GenericApplicationContext with registerBean(KClass) variants [SPR-15048] #19614
Comments
Sébastien Deleuze commented Juergen Hoeller Instead of creating a dedicated From a Kotlin developer POV, that would allow to write exactly the same code, but without requiring us to create a parallel class hierarchy for Kotlin additional methods. And extensions are really widely used in Kotlin, they are not perceived as less natural or second class support. They are statically resolved, you have to import them to have the additional methods, but the IDE make a very good job to auto import them when needed. 2 additional avantages I can see: this will make these additional methods available in every class extending |
Juergen Hoeller commented Good point, and as long as they are aligned with the existing |
Sébastien Deleuze commented Ok perfect :-) The tricky part will be to disable conditionally the kotlin compiler to avoid breaking JDK9 builds since https://youtrack.jetbrains.com/issue/KT-14988 is not fixed yet on Kotlin side. Do you think this is something doable? I will have a look myself but I just want to raise the point in case you have some thought about the feasibility. |
Juergen Hoeller commented It looks like conditional apply statements for a plugin actually work:
I've just tried it with our test sources but I guess it'll also work for regular resources. |
Sébastien Deleuze commented Awesome, thanks for your help. I will work on this Monday then. |
Sébastien Deleuze commented Implemented via this commit. I used Kotlin extensions nested in an IDEA currently fails to suggest automatically these extensions due some limitation on extension detection, so I have created KT-15440 to ask some improvements. Mix-IT website has been updated to use directly these extensions instead of its own. Juergen Hoeller If you are ok with that, I suggest adding for M4 similar extensions for Web functional client and server (see #19620) in order to provide a complete out of the box support for such functional Web application use case. |
Juergen Hoeller commented Sounds great! Let's make the Kotlin story as complete as we can for M4 and blog about it in January already. |
Juergen Hoeller opened SPR-15048 and commented
Following up on the
GenericApplicationContext
revision in #19398, let's consider creating a dedicatedGenericKotlinApplicationContext
subclass withregisterBean(KClass)
variants or Kotlin extensions toGenericApplicationContext
itself with the same method variations.Issue Links:
Referenced from: commits ff675f5
The text was updated successfully, but these errors were encountered: