You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I have some trouble with the ShedLock 4.43.0 in combination with Kotlin 1.7.22 and SpringBoot 2.7.6 (all latest versions) and JRE 11. The description in "Kotlin gotchas" in the documentation says "If @scheduled annotation is not present, you have to open the method by yourself." - In my case the annotation was present but I still had to open the methods manually. This was necessary because the methods were in an "abstract class" but the @scheduled in the derived class.
Maybe it's worth mentioning in the Gotchas section.
class Foo(something: Something): AbstractFoo(something) {
@Scheduled...
@SchedulerLock...
fun cronjob() {...}
}
class AbstractFoo(private val something: Something) {
fun save() { // here "something" is NULL although defined as not-nullable!
}
Originally I wanted to report this as a but to the "kotlin-spring" or Kotlin "all-open" plugin but then I noticed that the problem
only occurs when using the @SchedulerLock annotation.
Can you elaborate why this breaks the Spring CGI-proxy stuff? Is there maybe something that ShedLock could do better?
It's pretty nasty when you have a working project, then add ShedLock and suddenly NullPointerExceptions turn up!
The text was updated successfully, but these errors were encountered:
Hi, thanks for feedback. The reason is simple. @Scheduled does not require AOP, Spring just needs to call the method. For @SchedulerLock to work, you need AOP and Spring either has to generate a subclass or generate a proxy. I will try to update the documentation.
I have some trouble with the ShedLock 4.43.0 in combination with Kotlin 1.7.22 and SpringBoot 2.7.6 (all latest versions) and JRE 11. The description in "Kotlin gotchas" in the documentation says "If @scheduled annotation is not present, you have to open the method by yourself." - In my case the annotation was present but I still had to open the methods manually. This was necessary because the methods were in an "abstract class" but the @scheduled in the derived class.
Maybe it's worth mentioning in the Gotchas section.
My example is in https://github.com/lathspell/spring_kotlin_abstract_bug and roughly:
Originally I wanted to report this as a but to the "kotlin-spring" or Kotlin "all-open" plugin but then I noticed that the problem
only occurs when using the
@SchedulerLock
annotation.Can you elaborate why this breaks the Spring CGI-proxy stuff? Is there maybe something that ShedLock could do better?
It's pretty nasty when you have a working project, then add ShedLock and suddenly NullPointerExceptions turn up!
The text was updated successfully, but these errors were encountered: