0

I updated my application from spring 3.0.7RELEASE to 5.3.27, My application contains multiple bean definitions in context files. At every bean creation I get nested exception as follows -

org.springframework.beans.factory.UnsatisfiedDependencyException: Error creating bean with name 'exampleA': Unsatisfied dependency expressed through field 'com.externalLib.exampleB'; nested exception is org.springframework.beans.factory.NoSuchBeanDefinitionException: No qualifying bean of type 'com.externalLib.exampleB' available: expected at least 1 bean which qualifies as autowire candidate. Dependency annotations: {@org.springframework.beans.factory.annotation.Autowired(required=true)}.

In the above error exampleB is a bean from external library, My application uses several classes from external libraries which have different spring versions.

is there any way I can resolve the error without editing the external libraries?

Also is there a change in the way of how spring is handling autowiring in Spring 5.x versions?

I was able to edit a few of the external libraries being used and tried adding @Component/@Service/@Qualifier, but that did not resolve the issue.

  • That's a really big version jump. You _might_ try jumping to 4.x first and/or looking at the documentation on 4.x changes then 5.x changes. – dbreaux Aug 07 '23 at 21:24
  • Also, when you say "in context files", I assume you mean in XML files? You might post some examples of those files and the beans that are complaining. – dbreaux Aug 07 '23 at 21:25
  • Thanks, but I am updating to spring 5.x to eliminate vulnerabilities, all 4.x versions have vulnerabilities. And yes, they are XML files. – uchiha Itachi Aug 10 '23 at 15:57
  • Right, I meant to update to 4.x first, then go to 5.x after working that out. – dbreaux Aug 14 '23 at 01:53

0 Answers0