Rossen Stoyanchev opened SPR-16497 and commented

The following message appears repeatedly:

16:21:15.415 [main] WARN  org.springframework.http.converter.json.Jackson2ObjectMapperBuilder - For Jackson Kotlin classes support please add "com.fasterxml.jackson.module:jackson-module-kotlin" to the classpath

It seems we would be able to do some detection on startup and report only once, at least per Jackson2ObjectMapperBuilder initialization.


Affects: 5.0.3

Issue Links: - #20217 Log a warning in Jackson builder when Kotlin is used without jackson-module-kotlin

Referenced from: commits https://github.com/spring-projects/spring-framework/commit/7baf33fea0aa55251c549ef36ad32abddab8fcd9

Comment From: mauhiz

For people who reach this page wondering how to silence the warn:

  @Bean
  fun configureJackson2() = Jackson2ObjectMapperBuilderCustomizer { it.findModulesViaServiceLoader(true) }

Comment From: metaruslan

Is there a reason to put a warning at all? This registerWellKnownModulesIfAvailable method ignores the absences of all other modules completely silently, but puts a warning just for Kotlin. I encountered a situation when I got Kotlin as a transitive dependency, so now I get this warning. The workaround above is probably not desirable for me, because I don't want to do a "general" configuration, I only want to silence this Kotlin warning. I suggest two solutions: 1) Add a configuration to silence just the Kotlin warning without changing the general config for finding modules 2) Ignore ClassNotFoundException just like with all the other well-known modules.

Comment From: metaruslan

Should I create a separate issue for the problem I mentioned above? Just making sure I'm not missing anything, so that the new issue wouldn't be pointless.