According to the documentation and my observation an @EventListener annotated method is not opened by the spring plugin. Only if I open it manually, code is working. Otherwise there are these strange runtime errors with Spring AOP/CGLIB. Should the kotlin spring gradle plugin also open methods with @EventListener?
What’s your opinion?
By ‘open’, do you mean call/run/execute?
Also, it might help to see ‘these strange runtime errors’, and maybe also (a minimal, reproducible example of) your code.
No, I dont mean call/run/execute. The plugin (All-open compiler plugin | Kotlin Documentation) changes kotlins code generation esp. for some spring features: Classes and some Spring annotated methods are no longer final but open.
It is important to understand what this plugin does. Then you understand what I mean with strang errors.
My issue is that besides the current supported spring annotations the @EventListener annotation should also be supported.
Ah, thanks, that makes more sense.
Yes, you’d expect the plug-in to make all relevant classes and methods open/non-final (as Spring can’t do its magic otherwise). Presumably you’re getting errors along the lines of ‘Cannot subclass final class’?
But I don’t think we can tell you very much here (especially without seeing the Kotlin code and Gradle config). Have you considered opening an issue on YouTrack?
Here comes the example code. The test fails and (hopefully) should show what I mean.
BTW There isn’t a compile error. It’s just a runtime error.
YouTrack? Maybe my assumption is wrong, that the plugin should do the work.
kotlin-spring-plugin-eventlistener.zip (68.0 KB)
Any news after supplying code and config?