BeanUtils.instantiateClass(Constructor, Object…)
is not checking for the presence of Kotlin Reflect before calling KotlinDelegate.instantiateClass(…)
anymore. In case of the kotlin-reflect
missing from the classpath, this will lead to the following exception:
java.lang.NoClassDefFoundError: kotlin/reflect/jvm/ReflectJvmMapping
at org.springframework.beans.BeanUtils$KotlinDelegate.instantiateClass(BeanUtils.java:909)
While it might not be common for the reflection artifact to be missing if folks are using Kotlin, one might run into this if they use a library depending on kotlin-stdlib
only. Currently, one has to add kotlin-reflect
to avoid the exception. It would be cool if the code path was just skipped if the artifact is missing.
Comment From: wonyongg
Hi,
I created a PR for this issue since the change seemed fairly simple. If I misunderstood anything or this isn’t appropriate, please feel free to close it. Thank you for your time and consideration.🙏🏼