Quick revision
The short answer
Spring Boot's BOM pins versions of hundreds of libraries that Boot has tested together, so overriding one can cause runtime incompatibilities, such as NoSuchMethodError, that compile fine. We should override only when we need something urgent, typically a security fix that Boot has not released yet, use the BOM's version property to do it, and remove the override as soon as Boot catches up.
What to remember
In this answer, we saw that Spring Boot's BOM pins versions that Boot has tested together, and that overriding one can break at runtime with errors like NoSuchMethodError while compiling fine. The legitimate reason to override is an urgent security fix on the same version line. We do it with the BOM's version property so the whole library family moves together, document why, and remove the override when Boot catches up.
Your turn
Answer it aloud as you would in the interview, or type your answer below. Then show one part at a time and compare.
Spring Boot's BOM pins versions of hundreds of libraries that Boot has tested together, so overriding one can cause runtime incompatibilities, such as NoSuchMethodError, that compile fine. We should override only when we need something urgent, typically a security fix that Boot has not released yet, use the BOM's version property to do it, and remove the override as soon as Boot catches up.
Why this question is asked
Every Spring Boot project relies on dependency management it rarely looks at. When we add spring-boot-starter-data-jpa without a version, something decides which Hibernate, which JDBC pool and which Jackson we get. Overriding that decision is easy, and it is tempting when we want a newer feature or a fix. Interviewers ask about it because careless overrides cause some of the hardest bugs to diagnose: everything compiles and then fails at runtime. In this answer, we will recap what the BOM is, see how an override breaks things, look at the legitimate reason to override, and show the right way to do it and to undo it.
1A Quick Recap of the Spring Boot BOM
A BOM, a bill of materials, is a Maven artifact that lists versions for many dependencies without adding any of them. Spring Boot publishes spring-boot-dependencies, which manages the versions of Spring projects and hundreds of third party libraries: Hibernate, Jackson, Tomcat, Micrometer, database drivers and more. When our project uses spring-boot-starter-parent or imports this BOM, we can declare those dependencies without versions, and Boot's choice applies.
The important part is why Boot chooses those versions. For each Boot release, the Spring team builds and tests Boot's own auto-configuration and integration tests against exactly that set. Spring Data JPA is compiled against a specific Hibernate line, Boot's Jackson auto-configuration against a specific Jackson line, and so on. So the BOM is not a list of the newest versions; it is a list of versions known to work together.
2How an Override Breaks at Runtime
Suppose we override Hibernate to a newer minor or major line than the one our Boot version manages, because a blog post mentioned a feature. Our own code compiles fine, because it uses only stable JPA annotations. But Spring Data JPA and Boot's auto-configuration were compiled against the managed Hibernate version. If the newer line changed or removed a method they call, the failure only appears when that code runs.
| Library | Boot manages | After override | Tested together? |
|---|---|---|---|
| Spring Data JPA | version for this Boot | same | yes |
| Hibernate ORM | line tested by Boot | newer line | no |
| Boot JPA auto-configuration | version for this Boot | same | against the old line only |
The reason it compiles is that the compiler only checks our code against the jars on the classpath now. The calls from Spring's already-compiled classes into Hibernate are resolved by the JVM when they first run. That is why these errors appear in tests or, worse, in production on a code path nobody exercised. Notice that a partial override is just as risky: overriding jackson-databind without jackson-core and the Jackson modules mixes versions within one library family.
3The Legitimate Reason to Override
There is one common, good reason: a security fix. When a vulnerability is published for, say, Tomcat or a JSON library, the fixed version may be released before the next Boot patch includes it. Boot releases patches roughly monthly, so the gap is usually short, but for a serious vulnerability we may not want to wait.
In that case we override to the patched version of the same line, for example a newer patch of the same Tomcat minor. A patch release within the same line is designed to be compatible, so the risk is small. We should not jump to a new minor or major line to get a fix if a patch on the managed line exists.
4How to Override Correctly
The BOM declares a version property for each library it manages, and the safe way to override is to set that property. It changes the version everywhere the BOM uses it, including all modules of a library family that share one property, so the family stays consistent. Setting a version directly on one dependency can leave related modules on the old version.
There is a catch when the project imports the BOM in dependencyManagement instead of using the parent. Maven properties then do not reach into the imported BOM, so setting tomcat.version has no effect. In that case we import the library's own BOM, for example jackson-bom, before spring-boot-dependencies in the dependencyManagement section, or declare the managed artifacts explicitly. It is worth checking the result with mvn dependency:tree.
5Removing the Override When Boot Catches Up
An override is a debt. Once a Boot patch includes the fixed version, the override does nothing useful, and it becomes harmful at the next upgrade: the newer Boot may manage a later line, and our property silently pins the old one. I would always add a comment with the reason and the Boot version expected to include the fix, and remove the override in the same change that upgrades Boot.
Tools help here. Renovate and Dependabot can be configured to flag property overrides, and a simple CI check can list every overridden BOM property so the platform team sees them across the fleet.
6Follow-up questions
How do I see which version Boot manages for a library?
Look at the Dependency Versions appendix of the Boot reference for our Boot version, or run mvn dependency:tree or gradle dependencyInsight in the project. The tree shows the resolved version and whether it was managed.
Is it safe to add a library that Boot does not manage?
Yes, we choose its version ourselves. But check that its own transitive dependencies do not pull in different versions of libraries that Boot manages; Boot's management usually wins, which can break that library instead.
What if we need a feature only in a newer Hibernate or Jackson?
Usually the right move is to wait for or upgrade to the Boot version that manages it. If it is truly urgent, test the override thoroughly, including integration tests that exercise Spring Data and auto-configuration, and treat it as temporary.
7Conclusion
In this answer, we saw that Spring Boot's BOM pins versions that Boot has tested together, and that overriding one can break at runtime with errors like NoSuchMethodError while compiling fine. The legitimate reason to override is an urgent security fix on the same version line. We do it with the BOM's version property so the whole library family moves together, document why, and remove the override when Boot catches up.
Open with
Spring Boot's BOM, spring-boot-dependencies, pins the versions of hundreds of libraries, and the reason is that Boot builds and tests its auto-configuration and the Spring projects against exactly that set.
Then, if they want more
If I override one, say Hibernate or Jackson, my own code still compiles, but Spring's already compiled classes may call methods that changed in the new version, so I get NoSuchMethodError or ClassNotFoundException at runtime, often on a code path nobody tested.
So my rule is to override only when there is an urgent need, which in practice is almost always a security fix that is out before the next Boot patch, and to stay on the same version line, for example a newer patch of the managed Tomcat minor.
I do it with the BOM's version property, like tomcat.version, rather than putting a version on one artifact, because the property moves the whole library family consistently. If the project imports the BOM instead of using the parent, properties do not apply, so I import the library's own BOM first.
And I add a comment with the reason, then remove the override in the same change that upgrades Boot, because a forgotten override silently pins an old version later.
About this answer
- Last updated
- 12 November 2026
- Checked
- Its structure and format are checked automatically. Use it as a carefully prepared study note: where a detail matters, confirm it against the documentation below. What the checks cover
- Where the question comes from
- Written by Scrivio for practice. It is not taken from an interview.
- Official documentation
- Spring Boot reference
Report an issue with this answer
Copy the line below and send it to the author with what you found. It carries the address of this page.
Issue with "Why should you avoid overriding dependency versions that the Spring Boot BOM manages?": https://scrivio-interview-library.netlify.app/spring-boot/boot-migrations/0035e77551/