Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Avoid multiple warnings related to jackson-module-kotlin in Jackson2ObjectMapperBuilder [SPR-16497] #21040

Closed
spring-projects-issues opened this issue Feb 14, 2018 · 3 comments
Assignees
Labels
type: enhancement
Milestone

Comments

@spring-projects-issues
Copy link
Collaborator

@spring-projects-issues spring-projects-issues commented Feb 14, 2018

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 7baf33f

@mauhiz
Copy link

@mauhiz mauhiz commented Jan 10, 2020

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

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

@metaruslan
Copy link

@metaruslan metaruslan commented Sep 27, 2021

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.

@metaruslan
Copy link

@metaruslan metaruslan commented Nov 4, 2021

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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
type: enhancement
Projects
None yet
Development

No branches or pull requests

4 participants