Skip to content

Commit

Permalink
Do not extract FactoryBean generic in case of targetType mismatch
Browse files Browse the repository at this point in the history
Closes gh-32489
  • Loading branch information
jhoeller committed Apr 8, 2024
1 parent 46a0821 commit a0bd13c
Show file tree
Hide file tree
Showing 2 changed files with 387 additions and 437 deletions.
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* Copyright 2002-2023 the original author or authors.
* Copyright 2002-2024 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
Expand Down Expand Up @@ -108,7 +108,8 @@ protected boolean checkGenericTypeMatch(BeanDefinitionHolder bdHolder, Dependenc
Class<?> resolvedClass = targetType.resolve();
if (resolvedClass != null && FactoryBean.class.isAssignableFrom(resolvedClass)) {
Class<?> typeToBeMatched = dependencyType.resolve();
if (typeToBeMatched != null && !FactoryBean.class.isAssignableFrom(typeToBeMatched)) {
if (typeToBeMatched != null && !FactoryBean.class.isAssignableFrom(typeToBeMatched) &&
!typeToBeMatched.isAssignableFrom(resolvedClass)) {
targetType = targetType.getGeneric();
if (descriptor.fallbackMatchAllowed()) {
// Matching the Class-based type determination for FactoryBean
Expand Down
Loading

0 comments on commit a0bd13c

Please sign in to comment.