When using Spring Boot 2.2.6.RELEASE in Java, and I add a dependency that is written in Kotlin, Spring mentions

org.springframework.core.KotlinDetector - Kotlin reflection implementation not found at runtime, related features won't be available.

That's fine, the dependency doesn't use Kotlin reflection. What makes me concerned is that, after quickly looking around in the code it seems that Spring would change its behavior to use Kotlin internally if I were to add kotlin-reflect to the classpath.

This means that, if a dependency written in Kotlin, that also has kotlin-reflect, Spring will alter its behavior?

I don't know if this poses a problem but it feels wrong and there doesn't seem to be a way to prevent Spring from using Kotlin even if it's on the classpath.

Also, the message cannot be hidden unless I overwrite the logger configuration outside of Spring. I want to make the warning go away and I don't want to alter my logger configuration outside of Spring. Alternatively I could add kotlin-reflect to make the warning go away, but then I'm wondering what is happening under the hood if all Kotlin requirements are met.

So I suggest some kind of mechanism to completely prevent using Kotlin as well as any warnings about it if not desired.

Please let me know if this is a non-issue!

Comment From: philwebb

The KotlinDetector class is part of the core spring-framework project. I'm going to transfer this issue for that team to review.

Comment From: sdeleuze

It is true that nowadays there are JVM libraries developed with Kotlin, like OkHttp, and we should not display a log message for that use case. Since the behavior of the framework is already fine with the relevant conditional checks already in place, let just drop this log message potentially confusing.