Parameter 0 of constructor in ..... Spring Boot
Master System Design with Codemia
Enhance your system design skills with over 120 practice problems, detailed solutions, and hands-on exercises.
Introduction
The Spring Boot error that begins with Parameter 0 of constructor usually means Spring tried to create a bean, looked at the first constructor argument, and could not resolve what to inject there. The wording sounds cryptic, but the underlying issue is usually one of a few standard dependency-injection problems.
What the message actually means
Suppose Spring is creating a service like this:
If Spring cannot find a bean of type PaymentClient, startup fails with an error that points at parameter 0, because that is the first constructor parameter.
So the message is not about numbering for its own sake. It is telling you exactly which dependency was unresolved.
The most common root causes
The most common cause is that the dependency type is not registered as a Spring bean.
For example, if PaymentClient exists as a plain Java class but has no @Component, @Service, @Repository, @Configuration, or explicit @Bean registration, Spring has nothing to inject.
Another common cause is package scanning. If your application scans com.example.app, but the dependency lives in com.example.shared outside the scan path, the bean will not be discovered.
A third common problem is ambiguity. If two beans implement the same interface and Spring does not know which one to choose, constructor injection can also fail.
A missing bean example
Here is a working version that registers the dependency properly.
Now Spring can create PaymentClient first and inject it into OrderService.
Multiple beans of the same type
If you have more than one candidate bean, use @Qualifier or mark one bean as @Primary.
Without the qualifier, Spring may complain that it found multiple matching beans.
Configuration-based beans
Sometimes the missing dependency comes from a library or a third-party client you create in a configuration class rather than annotating directly.
This is the usual fix when the dependency class itself is not under your control.
How to debug it quickly
Read the full error message, not just the first line. Spring usually tells you the missing type and may also suggest whether no bean was found or multiple beans matched.
Then verify:
- the dependency type is a bean
- the bean is in a scanned package or declared with
@Bean - there is exactly one candidate unless you use qualifiers
- there is no circular dependency blocking creation
Those four checks resolve most constructor-parameter startup failures.
Common Pitfalls
A common mistake is creating a helper class with new in some places and expecting Spring to inject it elsewhere without registering it as a bean.
Another issue is forgetting package-scan boundaries. A correctly annotated bean is still invisible if it lives outside the scan scope.
It is also easy to treat the error as a constructor problem when the real issue is bean registration or ambiguity. The constructor is just where the failure becomes visible.
Summary
- '
Parameter 0 of constructormeans Spring could not resolve the first constructor dependency.' - The usual causes are missing bean registration, package scanning issues, or multiple matching beans.
- Register dependencies with stereotypes or
@Beanmethods. - Use
@Qualifieror@Primarywhen more than one bean matches. - Read the full startup error; it usually names the missing or ambiguous type directly.

