Closes GH-34187

Comment From: jhoeller

Thanks for the PR which helped to track down the root cause: The BeanNotOfRequiredTypeException is a symptom of a lower-level bug in BeanFactoryAnnotationUtils, so I'm going with a fix at that level for 6.2.2 this week.

See https://github.com/spring-projects/spring-framework/issues/34187#issuecomment-2586660996