Closed 4braincells closed 2 months ago
You have inconsistent set of Jackson components: probably jackson-databind
version is very old (that Enum was added in Jackson 2.2).
Ideally all components should have at least same minor version: but at least jackson-databind
has to be same or later minor version than jackson-datatype-jsr310
.
Well,
looking more carefully at the dependencies, it occurs that I even have to stick with 2.13.5,
because this is a constraint in Spring Boot 2.7.18 and also open-api 1.8.0.
+--- org.springframework.boot:spring-boot-starter-web -> 2.7.18
| +--- org.springframework.boot:spring-boot-starter:2.7.18 (*)
| +--- org.springframework.boot:spring-boot-starter-json:2.7.18
| | +--- org.springframework.boot:spring-boot-starter:2.7.18 (*)
| | +--- org.springframework:spring-web:5.3.31
| | | +--- org.springframework:spring-beans:5.3.31 (*)
| | | \--- org.springframework:spring-core:5.3.31 (*)
| | +--- com.fasterxml.jackson.core:jackson-databind:2.13.5
| | | +--- com.fasterxml.jackson.core:jackson-annotations:2.13.5
| | | | \--- com.fasterxml.jackson:jackson-bom:2.13.5 -> 2.15.4
| | | | +--- com.fasterxml.jackson.core:jackson-annotations:2.15.4 -> 2.13.5 (c)
| | | | +--- com.fasterxml.jackson.core:jackson-core:2.15.4 -> 2.13.5 (c)
| | | | +--- com.fasterxml.jackson.core:jackson-databind:2.15.4 -> 2.13.5 (c)
| | | | +--- com.fasterxml.jackson.datatype:jackson-datatype-jdk8:2.15.4 -> 2.13.5 (c)
| | | | +--- com.fasterxml.jackson.datatype:jackson-datatype-jsr310:2.15.4 (c)
| | | | +--- com.fasterxml.jackson.module:jackson-module-kotlin:2.15.4 (c)
| | | | \--- com.fasterxml.jackson.module:jackson-module-parameter-names:2.15.4 -> 2.13.5 (c)
| | | +--- com.fasterxml.jackson.core:jackson-core:2.13.5
| | | | \--- com.fasterxml.jackson:jackson-bom:2.13.5 -> 2.15.4 (*)
| | | \--- com.fasterxml.jackson:jackson-bom:2.13.5 -> 2.15.4 (*)
| | +--- com.fasterxml.jackson.datatype:jackson-datatype-jdk8:2.13.5
| | | +--- com.fasterxml.jackson.core:jackson-core:2.13.5 (*)
| | | +--- com.fasterxml.jackson.core:jackson-databind:2.13.5 (*)
| | | \--- com.fasterxml.jackson:jackson-bom:2.13.5 -> 2.15.4 (*)
| | +--- com.fasterxml.jackson.datatype:jackson-datatype-jsr310:2.13.5 -> 2.15.4
| | | +--- com.fasterxml.jackson.core:jackson-annotations:2.15.4 -> 2.13.5 (*)
| | | +--- com.fasterxml.jackson.core:jackson-core:2.15.4 -> 2.13.5 (*)
| | | +--- com.fasterxml.jackson.core:jackson-databind:2.15.4 -> 2.13.5 (*)
| | | \--- com.fasterxml.jackson:jackson-bom:2.15.4 (*)
| | \--- com.fasterxml.jackson.module:jackson-module-parameter-names:2.13.5
| | +--- com.fasterxml.jackson.core:jackson-core:2.13.5 (*)
| | +--- com.fasterxml.jackson.core:jackson-databind:2.13.5 (*)
| | \--- com.fasterxml.jackson:jackson-bom:2.13.5 -> 2.15.4 (*)
Seems I have to upgrade Spring Boot ...
@4braincells yes that is a good idea. Spring Boot tends to work well with reasonably wide range of newer Jackson versions (but requires some minimum wrt features it needs), but it is safer to use latest patches for whichever minor Jackson version it uses.
One thing that can help, too, is use of jackson-bom
(https://mvnrepository.com/artifact/com.fasterxml.jackson/jackson-bom) as BOM (pom dependency with scope import
) -- that import will define consistent set of all Jackson components. That is, if you import jackson-bom 2.13.5, it adds managed dependency versions for everything, including transitive dependencies. That should reduce likelihood of inconsistent Jackson versions.
And in fact I think SB uses jackson-bom
already, looking at dependency graph.
I am using the ObjectMapper for deserialization of retrieved records (REST)
After update to 2.17.1 (resp 2.16.*),
I get
Spring 2.7.18 java 17
I tried a couple of ways to initialize ObjectMapper
I am using LocaleDate as data type.
What's different since 2.16, why am I stuck with 2.15?
Thanks for any hint.
I can't upgrade to Spring Boot 3.3 now because this will be a bigger step.