0

Can anybody tell me please why Spring container injects the dependency by highest parameterized constructor in case of constructor autowiring mode. why it is not choosing even single argument parameterized constructor present.

Nalla Srinivas
  • 913
  • 1
  • 9
  • 17

1 Answers1

0

Spring doc says.

Only one annotated constructor per-class can be marked as required, but multiple non-required constructors can be annotated. In that case, each is considered among the candidates and Spring uses the greediest constructor whose dependencies can be satisfied, that is the constructor that has the largest number of arguments.

Lovababu Padala
  • 2,415
  • 2
  • 20
  • 28