Spring Boot ClassNotFoundException org.springframework.core.metrics.ApplicationStartup
Interview Questions practice on Codemia
Over 8,000 real interview questions from top companies, searchable by company and role.
Introduction
This ClassNotFoundException usually means your Spring Boot and Spring Framework versions are out of alignment. The class org.springframework.core.metrics.ApplicationStartup exists in newer Spring Framework releases, so if your application or one of its dependencies expects it but an older spring-core jar ends up on the runtime classpath, the application fails during startup. The real fix is to restore dependency consistency, not to add random jars manually.
Why This Class Goes Missing
ApplicationStartup was introduced in newer generations of Spring Framework and then used by corresponding Spring Boot versions. If you are running code that expects that class but the classpath contains an older Spring Core, Java throws ClassNotFoundException when the application starts or a configuration path tries to reference it.
This typically happens in one of these situations:
- Boot version upgraded, but transitive Spring dependencies were pinned manually to older versions
- multiple Spring versions appear in the dependency graph
- a parent BOM is missing or overridden incorrectly
- an old container or fat jar is still being used at runtime
So the problem is usually dependency resolution, not the source code that mentions ApplicationStartup.
Let Spring Boot Manage Spring Versions
The simplest protection is to let Spring Boot manage the Spring dependency set through its BOM or starter parent.
A normal Maven setup looks like this:
The important point is not that exact version. The important point is that Boot should control the matching Spring versions unless you have a very strong reason to override them.
Find the Actual Version Conflict
When this exception appears, inspect the resolved dependency graph instead of guessing.
For Maven:
For Gradle:
You are looking for multiple Spring versions or an older spring-core that should not be there. In a healthy Boot application, the Spring jars should line up consistently with the Boot release.
A Typical Bad Configuration
A common anti-pattern is mixing Boot starters with manually pinned Spring dependencies.
If the Boot version expects a newer Spring release, this manual pin can quietly downgrade the runtime classpath and trigger the missing-class error.
In most Boot apps, the clean fix is to remove that manual Spring version override.
Clean and Rebuild the Runtime Artifact
Sometimes the dependency graph is fixed but the running artifact is stale. Rebuild the application completely and make sure the deployed JAR or container image actually contains the new dependency set.
A clean rebuild helps rule out leftover packaging issues:
or:
This matters especially when Docker layers, CI caches, or older fat JARs can keep the wrong runtime in circulation.
Watch for IDE and Test Classpaths Too
The application may succeed from the command line but fail in the IDE, or the reverse, if different classpaths are used. Tests can also pull in different dependency combinations from the main runtime.
So check the failing environment specifically:
- production runtime
- local IDE launch
- test runtime
- container image
The same exception message can come from different dependency graphs in each of those contexts.
Do Not Fix This by Copying One Class or Jar
A tempting but incorrect response is to manually add one Spring jar until the missing class disappears. That is risky because Spring modules are version-coupled. If one class is missing due to version skew, there are often more incompatibilities waiting behind it.
The durable solution is to get the whole Spring stack back onto a compatible set.
Common Pitfalls
The most common mistake is manually overriding Spring Framework module versions in a Spring Boot application that should be using Boot-managed dependencies.
Another mistake is checking only compile-time dependencies and not the runtime artifact that actually gets launched.
Teams also fix the build file but forget to rebuild or redeploy the final JAR or container image, leaving the stale classpath in place.
Summary
- This exception usually means Spring Boot and Spring Framework versions are out of sync.
- '
ApplicationStartupis present only in newer Spring versions expected by matching Boot releases.' - Let Spring Boot manage Spring dependency versions whenever possible.
- Inspect the dependency tree to find older
spring-corejars or version conflicts. - Fix the dependency set as a whole, then cleanly rebuild the artifact that is actually running.
Related reading
- Spring Boot ClassNotFoundException when configuring maxUploadSize of CommonMultipartResolver
- Spring Boot classpath
- Spring Boot Cloud Zuul Proxy 404 Error
- Spring boot config server
- Spring boot context load test hangs
- Spring Boot CORS filter - CORS preflight channel did not succeed
- Spring Boot Configuration Class is simply ignored and not loaded
- Spring Boot configure and use two data sources

OOD Fundamentals
Master object-oriented design from first principles, SOLID, design patterns, and classic interview problems with hands-on coding.
View the courseTrack what you have practised
A free account saves your progress, solutions and study plan across every problem on Codemia.
Interview Questions practice on Codemia
Over 8,000 real interview questions from top companies, searchable by company and role.