Spring Boot "UnsatisfiedDependencyException" in CI
Spring tried to instantiate a bean but could not supply one of its dependencies. The nested "Caused by" line names which dependency failed, and that inner exception is the real problem.
What this error means
Context startup fails with "UnsatisfiedDependencyException: Error creating bean with name 'X': Unsatisfied dependency expressed through ...", followed by a Caused-by chain.
org.springframework.beans.factory.UnsatisfiedDependencyException: Error creating bean
with name 'orderService': Unsatisfied dependency expressed through constructor parameter 0:
Error creating bean with name 'paymentClient': ... Caused by: ...Common causes
A required dependency bean could not be built
The dependency itself failed to construct (a bad DataSource, a missing property), and that failure bubbles up as an unsatisfied dependency on the outer bean.
A profile or component is missing in CI
A collaborator bean only exists under a profile that is not active on the runner, so the injection point has nothing to wire.
How to fix it
Follow the Caused-by chain to the root
- Read past the outer bean to the innermost "Caused by" exception.
- Fix that root cause (property, DataSource, missing bean).
- Re-run; the outer UnsatisfiedDependencyException clears once the dependency builds.
Activate the profile that defines the collaborator
Ensure the CI profile registers every bean the dependency graph needs.
env:
SPRING_PROFILES_ACTIVE: ciHow to prevent it
- Keep constructor dependencies explicit so missing beans fail loudly.
- Ensure the CI profile registers the same beans as production paths under test.
- Read the innermost Caused-by, not the top-level bean name.