Remove jackson-module-kotlin warning

Closes gh-26962
This commit is contained in:
Sébastien Deleuze 2021-06-08 11:27:31 +02:00
parent 05eca05671
commit 6251222a23
2 changed files with 6 additions and 12 deletions

View File

@ -105,8 +105,6 @@ import org.springframework.util.xml.StaxUtils;
*/
public class Jackson2ObjectMapperBuilder {
private static volatile boolean kotlinWarningLogged;
private final Log logger = HttpLogging.forLogName(getClass());
private final Map<Class<?>, Class<?>> mixIns = new LinkedHashMap<>();
@ -863,11 +861,7 @@ public class Jackson2ObjectMapperBuilder {
modulesToRegister.set(kotlinModule.getTypeId(), kotlinModule);
}
catch (ClassNotFoundException ex) {
if (!kotlinWarningLogged) {
kotlinWarningLogged = true;
logger.warn("For Jackson Kotlin classes support please add " +
"\"com.fasterxml.jackson.module:jackson-module-kotlin\" to the classpath");
}
// jackson-module-kotlin not available
}
}
}

View File

@ -31,6 +31,11 @@ and https://bintray.com/bintray/jcenter/org.jetbrains.kotlin%3Akotlin-reflect[`k
to be present on the classpath. They are provided by default if you bootstrap a Kotlin project on
https://start.spring.io/#!language=kotlin&type=gradle-project[start.spring.io].
NOTE: The https://github.com/FasterXML/jackson-module-kotlin[Jackson Kotlin module] is required
for serializing or deserializing JSON data for Kotlin classes with Jackson, so make sure to add the
`com.fasterxml.jackson.module:jackson-module-kotlin` dependency to your project if you have such need.
It is automatically registered when found in the classpath.
[[kotlin-extensions]]
== Extensions
@ -120,11 +125,6 @@ Kotlin parameter names are recognized through a dedicated `KotlinReflectionParam
which allows finding interface method parameter names without requiring the Java 8 `-parameters`
compiler flag to be enabled during compilation.
The https://github.com/FasterXML/jackson-module-kotlin[Jackson Kotlin module], which is required
for serializing or deserializing JSON data, is automatically registered when
found in the classpath, and a warning message is logged if Jackson and Kotlin are
detected without the Jackson Kotlin module being present.
You can declare configuration classes as
https://kotlinlang.org/docs/reference/nested-classes.html[top level or nested but not inner],
since the later requires a reference to the outer class.