Skip to content

Commit 6251222

Browse files
committed
Remove jackson-module-kotlin warning
Closes gh-26962
1 parent 05eca05 commit 6251222

File tree

2 files changed

+6
-12
lines changed

2 files changed

+6
-12
lines changed

spring-web/src/main/java/org/springframework/http/converter/json/Jackson2ObjectMapperBuilder.java

Lines changed: 1 addition & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -105,8 +105,6 @@
105105
*/
106106
public class Jackson2ObjectMapperBuilder {
107107

108-
private static volatile boolean kotlinWarningLogged;
109-
110108
private final Log logger = HttpLogging.forLogName(getClass());
111109

112110
private final Map<Class<?>, Class<?>> mixIns = new LinkedHashMap<>();
@@ -863,11 +861,7 @@ private void registerWellKnownModulesIfAvailable(MultiValueMap<Object, Module> m
863861
modulesToRegister.set(kotlinModule.getTypeId(), kotlinModule);
864862
}
865863
catch (ClassNotFoundException ex) {
866-
if (!kotlinWarningLogged) {
867-
kotlinWarningLogged = true;
868-
logger.warn("For Jackson Kotlin classes support please add " +
869-
"\"com.fasterxml.jackson.module:jackson-module-kotlin\" to the classpath");
870-
}
864+
// jackson-module-kotlin not available
871865
}
872866
}
873867
}

src/docs/asciidoc/languages/kotlin.adoc

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -31,6 +31,11 @@ and https://bintray.com/bintray/jcenter/org.jetbrains.kotlin%3Akotlin-reflect[`k
3131
to be present on the classpath. They are provided by default if you bootstrap a Kotlin project on
3232
https://start.spring.io/#!language=kotlin&type=gradle-project[start.spring.io].
3333

34+
NOTE: The https://github.com/FasterXML/jackson-module-kotlin[Jackson Kotlin module] is required
35+
for serializing or deserializing JSON data for Kotlin classes with Jackson, so make sure to add the
36+
`com.fasterxml.jackson.module:jackson-module-kotlin` dependency to your project if you have such need.
37+
It is automatically registered when found in the classpath.
38+
3439
[[kotlin-extensions]]
3540
== Extensions
3641

@@ -120,11 +125,6 @@ Kotlin parameter names are recognized through a dedicated `KotlinReflectionParam
120125
which allows finding interface method parameter names without requiring the Java 8 `-parameters`
121126
compiler flag to be enabled during compilation.
122127

123-
The https://github.com/FasterXML/jackson-module-kotlin[Jackson Kotlin module], which is required
124-
for serializing or deserializing JSON data, is automatically registered when
125-
found in the classpath, and a warning message is logged if Jackson and Kotlin are
126-
detected without the Jackson Kotlin module being present.
127-
128128
You can declare configuration classes as
129129
https://kotlinlang.org/docs/reference/nested-classes.html[top level or nested but not inner],
130130
since the later requires a reference to the outer class.

0 commit comments

Comments
 (0)