Get all beans of the given type.

@param resolutionContext The bean resolution context
@param beanType          The bean type
@param <T>               The bean type parameter
@return The found beans
343782
protected @Nonnull <T> Collection<T> getBeansOfType(@Nullable BeanResolutionContext resolutionContext, @Nonnull Class<T> beanType) {
        return getBeansOfTypeInternal(resolutionContext, beanType, null);
    }
1353466
private static <T> T getContextualReference(Class<T> type, BeanManager beanManager, Bean<?> bean)
    {
        //noinspection unchecked
        return getContextualReference(type, beanManager, new HashSet<Bean<?>>((Collection) Arrays.asList(bean)));
    }
10561
@NonNull
	public static ResolvedType resolveSubtype(@NonNull ResolvedType superType, @NonNull Class<?> subType)
	{
		return typeResolver.resolveSubtype(superType, subType);
	}
78890
public List<BeanType<ValidationMappingDescriptor>> getAllBean()
   {
      List<BeanType<ValidationMappingDescriptor>> list = new ArrayList<BeanType<ValidationMappingDescriptor>>();
      List<Node> nodeList = model.get("bean");
      for(Node node: nodeList)
      {
         BeanType<ValidationMappingDescriptor>  type = new BeanTypeImpl<ValidationMappingDescriptor>(this, "bean", model, node);
         list.add(type);
      }
      return list;
   }
607670
public <T extends Mapping> T getMapping(MappingType type)
    {
        return (T) mappings.get(type);
    }
324812
private Set<String> resolveBeanNames(ListableBeanFactory beanFactory, Class<?> clazz) {

		final Set<String> result = new HashSet<String>();

		Map<String, ?> beanMap = beanFactory.getBeansOfType(clazz);
		for (String name : beanMap.keySet()) {
			if (name != null && !name.startsWith("scopedTarget.")) {
				result.add(name);
			}
		}

		return result;

	}
555588
public static final Class getType(Object bean, String property)
    {
        return (Class) doFor(bean, property, null, BeanHelper::getObjectType, BeanHelper::getObjectType, BeanHelper::getFieldType, BeanHelper::getMethodType);
    }
745208
public static Map<String, Object> getBeansWithAnnotation(ApplicationContext appContext,
            Class<? extends Annotation> annotationType) {
        try {
            return appContext.getBeansWithAnnotation(annotationType);
        } catch (BeansException e) {
            return new HashMap<String, Object>();
        }
    }
331701
private TypeResolver getTypeResolver() {
        TypeResolver typeResolver = scannerContext.peek(TypeResolver.class);
        if (typeResolver == null) {
            throw new IllegalStateException("Cannot find Java type resolver.");
        }
        return typeResolver;
    }
112603
public static Object getBean(String name, Class requiredType) throws BeansException {
		return applicationContext.getBean(name, requiredType);
	}
707727
public <T extends Mapping> T findMapping(MappingType type)
    {
        return (T) this.findMapping(type, DEFAULT_PREDICATE);
    }
1027957
public static <T> Map<String, T> getBeansOfType(ApplicationContext appContext, Class<T> clazz) {
        try {
            return appContext.getBeansOfType(clazz);
        } catch (BeansException e) {
            return new HashMap<String, T>();
        }
    }
1187722
@Internal
    @SuppressWarnings("WeakerAccess")
    protected void injectBeanMethod(BeanResolutionContext resolutionContext, DefaultBeanContext context, int methodIndex, Object bean) {
        MethodInjectionPoint methodInjectionPoint = methodInjectionPoints.get(methodIndex);
        Argument[] methodArgumentTypes = methodInjectionPoint.getArguments();
        Object[] methodArgs = new Object[methodArgumentTypes.length];
        for (int i = 0; i < methodArgumentTypes.length; i++) {
            methodArgs[i] = getBeanForMethodArgument(resolutionContext, context, methodIndex, i);
        }
        try {
            methodInjectionPoint.invoke(bean, methodArgs);
        } catch (Throwable e) {
            throw new BeanInstantiationException(this, e);
        }
    }
1136048
private static PropertyDescriptor[][] getBeanProperties(Class<?> beanType) {
        List<PropertyDescriptor> readProperties = 
            new ArrayList<PropertyDescriptor>();
        
        List<PropertyDescriptor> writeProperties = 
            new ArrayList<PropertyDescriptor>();

        try {
            Map<?, ?> map = CompleteIntrospector.getAllProperties(beanType);

            Iterator<?> it = map.values().iterator();
            while (it.hasNext()) {
                PropertyDescriptor pd = (PropertyDescriptor)it.next();
                if (pd.getReadMethod() != null) {
                    readProperties.add(pd);
                }
                if (pd.getWriteMethod() != null) {
                    writeProperties.add(pd);
                }
            }
        }
        catch (IntrospectionException e) {
            throw new RuntimeException(e.toString());
        }

        PropertyDescriptor[][] props = new PropertyDescriptor[2][];

        props[0] = new PropertyDescriptor[readProperties.size()];
        readProperties.toArray(props[0]);
        props[1] = new PropertyDescriptor[writeProperties.size()];
        writeProperties.toArray(props[1]);

        return props;
    }
55089
protected @Nonnull Iterable<BeanConfiguration> resolveBeanConfigurations() {
        final SoftServiceLoader<BeanConfiguration> definitions = SoftServiceLoader.load(BeanConfiguration.class, classLoader);
        List<BeanConfiguration> list = new ArrayList<>(20);
        for (ServiceDefinition<BeanConfiguration> definition : definitions) {
            if (definition.isPresent()) {
                list.add(definition.load());
            }
        }
        return list;
    }
812423
@SuppressWarnings("unchecked")
    protected @Nonnull <T> Collection<BeanDefinition<T>>  findBeanCandidates(@Nonnull Class<T> beanType, @Nullable BeanDefinition<?> filter) {
        ArgumentUtils.requireNonNull("beanType", beanType);

        if (LOG.isDebugEnabled()) {
            LOG.debug("Finding candidate beans for type: {}", beanType);
        }
        // first traverse component definition classes and load candidates

        Collection<BeanDefinitionReference> beanDefinitionsClasses;

        if (indexedTypes.contains(beanType)) {
            beanDefinitionsClasses = beanIndex.get(beanType);
            if (beanDefinitionsClasses == null) {
                beanDefinitionsClasses = Collections.emptyList();
            }
        } else {
            beanDefinitionsClasses = this.beanDefinitionsClasses;
        }

        if (!beanDefinitionsClasses.isEmpty()) {

            Stream<BeanDefinition<T>> candidateStream = beanDefinitionsClasses
                    .stream()
                    .filter(reference -> {
                        if (reference.isPresent()) {
                            Class<?> candidateType = reference.getBeanType();
                            final boolean isCandidate = candidateType != null && (beanType.isAssignableFrom(candidateType) || beanType == candidateType);
                            return isCandidate && reference.isEnabled(this);
                        }
                        return false;
                    })
                    .map(ref -> {
                        BeanDefinition<T> loadedBean;
                        try {
                            loadedBean = ref.load(this);
                        } catch (Throwable e) {
                            throw new BeanContextException("Error loading bean [" + ref.getName() + "]: " + e.getMessage(), e);
                        }
                        return loadedBean;
                    });

            if (filter != null) {
                candidateStream = candidateStream.filter(candidate -> !candidate.equals(filter));
            }
            Set<BeanDefinition<T>> candidates = candidateStream
                    .filter(candidate -> candidate.isEnabled(this))
                    .collect(Collectors.toSet());

            if (!candidates.isEmpty()) {
                filterReplacedBeans(candidates);
            }

            if (LOG.isDebugEnabled()) {
                LOG.debug("Resolved bean candidates {} for type: {}", candidates, beanType);
            }
            return candidates;
        } else {
            if (LOG.isDebugEnabled()) {
                LOG.debug("No bean candidates found for type: {}", beanType);
            }
            return Collections.emptySet();
        }
    }
1190546
public <T> Object getBeanProperty(final T bean, final Object property) {
        if (bean != null) {
            @SuppressWarnings("unchecked")
            GetResolver<T> resolver = this.getters.unsafeGet(bean.getClass());
            if (resolver != null) {
                return resolver.get(bean, property);
            }
        }
        return this.resolverManager.get(bean, property);
    }