A scanner flags jackson-databind: how to upgrade it in Gradle
jackson-databind vulnerability reported by a dependency scannerShort answer
Find where the old jackson-databind comes from, then raise it. A dependency constraint raises a transitive version without adding a new dependency. In a Spring Boot project the version is managed by the BOM, so change its Jackson version property, or use a resolution rule if you use Gradle's own BOM support.
Fix it fast
1Find out which cause you have
Ask Gradle which version is resolved and which dependency asked for it. The arrow in the output (1.2 -> 1.3) shows an upgrade.
./gradlew -q dependencyInsight --dependency jackson-databind --configuration runtimeClasspath2Match what you see, then jump to its fix
- 1
dependencyInsight shows jackson-databind reached only through another libraryA transitive dependency pulls in the old versionFix - 2
The project applies the io.spring.dependency-management plugin and the version matches the Boot release, not a libraryThe Spring Boot dependency management pins JacksonFix - 3
The version property is set but nothing changes, and the build uses platform(SpringBootPlugin.BOM_COORDINATES)Gradle's native BOM support ignores the Boot propertyFix
- 1
What does the error look like?
jackson-databind vulnerability reported by a dependency scanner
Cause 1 of 3
A transitive dependency pulls in the old version
1Check
Read the dependency paths in the insight output and note the library on top of the path.
./gradlew -q dependencyInsight --dependency jackson-databind --configuration runtimeClasspath2Fix
Add a dependency constraint. A constraint sets a version requirement without adding the module as a direct dependency, and has no effect if the module is not in the graph.
dependencies {
constraints {
implementation("com.fasterxml.jackson.core:jackson-databind:2.18.2") {
because("fixes the reported vulnerability")
}
}
}3Verify
Run the insight again: the selection reason shows By constraint and the version is the new one.
./gradlew -q dependencyInsight --dependency jackson-databind --configuration runtimeClasspathConfirmed by docs.gradle.org
Cause 2 of 3
The Spring Boot dependency management pins Jackson
1Check
Spring Boot's BOM manages the Jackson version through a property. Find the property name for your Boot version in the dependency versions properties appendix (it lists a Jackson Bom row, jackson-bom.version, and a separate Jackson 2 Bom row, jackson-2-bom.version; pick the one that manages the com.fasterxml jackson-databind you see).
./gradlew -q dependencyInsight --dependency jackson-databind --configuration runtimeClasspath2Fix
Set the managed version property in the build script. Spring warns that overriding versions can cause compatibility problems, so choose a patch release of the same Jackson line.
// build.gradle
ext['jackson-bom.version'] = '2.18.2'3Verify
Run the insight task again and confirm the version changed.
./gradlew -q dependencyInsight --dependency jackson-databind --configuration runtimeClasspathConfirmed by docs.spring.io
Cause 3 of 3
Gradle's native BOM support ignores the Boot property
1Check
Spring's docs state that with Gradle's bom support the properties from spring-boot-dependencies cannot control the managed versions.
grep -n -E "BOM_COORDINATES|spring-boot-dependencies" build.gradle*2Fix
Use a mechanism Gradle provides, such as a resolution strategy rule that forces the group to a version.
configurations.all {
resolutionStrategy.eachDependency { details ->
if (details.requested.group == 'com.fasterxml.jackson.core') {
details.useVersion '2.18.2'
}
}
}3Verify
Run the insight task; the selection reason shows a rule.
./gradlew -q dependencyInsight --dependency jackson-databind --configuration runtimeClasspathConfirmed by docs.spring.io
How do I stop it coming back?
- Run dependencyInsight on any flagged library before changing versions, so you fix the real source.
- Prefer upgrading the library that brings Jackson in when a newer release exists.
- Keep Jackson modules on one version: jackson-core, databind and annotations should move together.
Sources
How was this page made?
I drafted this page with AI assistance from the official documents listed under Sources. Every cause above names the document that confirms it. I have not reproduced this fix on a machine of my own yet, so read it as documented guidance, not a test report. Found a mistake? Tell me.
Which stack is behind this page?
Projects of mine built on the same technologies:
- QistLockA NestJS and React SaaS driving an Android Device Owner agent that locks financed phones when payments lapse.
- Dispatch ProA real-time logistics platform: Flutter apps, Spring Boot services and a Kafka event pipeline on AWS.
- Nuclear Home VideoA video-streaming Android app built from scratch, engineered for smooth playback.
Related fixes
Back end
Gradle cannot resolve spring-boot-gradle-plugin after a Spring Boot 3 upgrade
Plugin [id: 'org.springframework.boot', version: '3.0.1'] was not found in any of the following sources
Spring Boot 3 needs Java 17 or newer and a recent Gradle, and its Gradle plugin is published on the Gradle Plugin Portal.
3 causes, each with a fixBack end
bootJar cannot find the main class of a Spring Boot project
Main class name has not been configured and it could not be resolved
The Spring Boot Gradle plugin looks in the main source set's output for a class with a public static void main method.
2 causes, each with a fixBack end
Spring Boot fails at startup with an error processing a condition on an auto-configuration
java.lang.IllegalStateException: Error processing condition on org.springframework.boot.autoconfigure.jdbc.JndiDataSourceAutoConfiguration
This message only says Spring Boot failed while evaluating an auto-configuration condition.
3 causes, each with a fixBack end
Swagger UI URL shows the Whitelabel Error Page in Spring Boot
Whitelabel Error Page when opening /swagger-ui.html
The Whitelabel page means Spring found no handler for that address.
3 causes, each with a fixBack end
Spring Boot will not start because port 8080 is already taken
Action: Identify and stop the process that's listening on port 8080 or configure this application to listen on another port.
Spring Boot listens on 8080 unless told otherwise, and only one process can own a port.
3 causes, each with a fixBack end
Spring Boot cannot load the MySQL JDBC driver class
Cannot load driver class: com.mysql.jdbc.Driver
Spring Boot checks that the driver class you name can be loaded before it builds the connection pool.
3 causes, each with a fix