konrad-kaminski / spring-kotlin-coroutine

Kotlin coroutine support for Spring.
448 stars 69 forks source link

KClass based ConditionalOnClass raises TypeNotPresentException #5

Open sdeleuze opened 6 years ago

sdeleuze commented 6 years ago

kotlin-reflect seems not super lenient with the KClass based @ConditionalOnClass variant shipped with spring-kotlin-coroutine, it throws TypeNotPresentException when for example RxJava is not on the classpath.

To reproduce the issue, comment these 2 RxJava dependencies on my sample Spring + Coroutine app.

I suggest using regular Class based @ConditionalOnClass for now, and raising an issue about that on https://youtrack.jetbrains.com/issues/KT in order to be more defensive about that on kotlin-reflect.

konrad-kaminski commented 6 years ago

There is something weird with those annotations and I'm yet to find out what it is. For now there's a workaround in 0.3.1 - the @ConditionalOnClass requires the name of the class as String. I'm leaving this issue open until I find a proper solution since I don't like this workaround.