ObjectMapper.enable is deprecated since 2.7.x
See original GitHub issueDescribe the bug
According to the docs, we need to use the ObjectMapperCustomizer to customize jackson.
Since Jackson 2.13(Quarkus 2.7), the enable(MapperFeature... f) function is deprecated and we should replace it with JsonMapper.builder().enable(...).
Sadly we only get a ObjectMapper which doesn’t allow us to use builder().
Expected behavior
A way to use
mapper.enable(
ACCEPT_CASE_INSENSITIVE_ENUMS,
ACCEPT_CASE_INSENSITIVE_PROPERTIES,
ACCEPT_CASE_INSENSITIVE_VALUES
)
Actual behavior
Deprecation warning.
How to Reproduce?
@Singleton
class JacksonMapperConfig : ObjectMapperCustomizer {
override fun customize(mapper: ObjectMapper) {
mapper.registerKotlinModule().enable(
ACCEPT_CASE_INSENSITIVE_ENUMS,
ACCEPT_CASE_INSENSITIVE_PROPERTIES,
ACCEPT_CASE_INSENSITIVE_VALUES
).registerModules(
Builder()
.configure(NullIsSameAsDefault, true)
.configure(NullToEmptyCollection, true)
.configure(NullToEmptyMap, true)
.build(),
JavaTimeModule(),
Jdk8Module(),
ParameterNamesModule()
)
}
}
Output of uname -a or ver
Linux 5.16.8-zen1-1-zen
Output of java -version
openjdk 17.0.1 2021-10-19 OpenJDK Runtime Environment (build 17.0.1+12) OpenJDK 64-Bit Server VM (build 17.0.1+12, mixed mode)
GraalVM version (if different from Java)
N/A
Quarkus version or git rev
2.7.1
Build tool (ie. output of mvnw --version or gradlew --version)
------------------------------------------------------------ Gradle 7.4 ------------------------------------------------------------ Build time: 2022-02-08 12:14:25 UTC Revision: <unknown> Kotlin: 1.5.31 Groovy: 3.0.9 Ant: Apache Ant™ version 1.10.11 compiled on July 10 2021 JVM: 17.0.1 (Oracle Corporation 17.0.1+12) OS: Linux 5.16.8-zen1-1-zen amd64
Additional information
No response
Issue Analytics
- State:
- Created 2 years ago
- Comments:5 (2 by maintainers)
Top Related StackOverflow Question
Interesting… I wonder if it makes sense to wait for Jackson 3.x to make a change with regard to this
Thanks, I’ll have a look next week