BeanFactoryUtils returns all beans including beans defined in ancestor bean factories

pull/515/head
DerekYRC 3 years ago
parent 6a8eb51654
commit 1a919e29d7

@ -25,7 +25,6 @@ import java.util.stream.Collectors;
import org.springframework.beans.factory.BeanFactory;
import org.springframework.beans.factory.ListableBeanFactory;
import org.springframework.beans.factory.support.DefaultListableBeanFactory;
import static org.springframework.beans.factory.BeanFactoryUtils.beanNamesForTypeIncludingAncestors;
@ -39,7 +38,7 @@ public final class BeanFactoryUtils {
}
public static <T> List<T> getBeans(BeanFactory beanFactory, Class<T> requiredType) {
if (!(beanFactory instanceof DefaultListableBeanFactory)) {
if (!(beanFactory instanceof ListableBeanFactory)) {
throw new RuntimeException("bean factory not support get list bean. factory type = " + beanFactory.getClass()
.getName());
}

Loading…
Cancel
Save