GenericBeanFactoryAccessor (Grails 6.0.0)

Package: org.grails.spring.beans.factory

## [Java] Class GenericBeanFactoryAccessor

- org.grails.spring.beans.factory.GenericBeanFactoryAccessor

-     public class GenericBeanFactoryAccessor
      extends java.lang.Object

  A fork of the Spring 2.5.6 GenericBeanFactoryAccess class that was removed from Spring 3.0.

  Authors:
    Rob Harrop
    Juergen Hoeller
  Since:
    2.0

- - ### Field Summary

    Fields
    Modifiers | Name | Description
    --- | --- | ---
    `private org.springframework.beans.factory.ListableBeanFactory` | `beanFactory` | The org.springframework.beans.factory.ListableBeanFactory being wrapped.

  - ### Constructor Summary

    Constructors
    Constructor and description
    `GenericBeanFactoryAccessor (org.springframework.beans.factory.ListableBeanFactory beanFactory)` Constructs a `GenericBeanFactoryAccessor` that wraps the supplied org.springframework.beans.factory.ListableBeanFactory.

  - ### Methods Summary

    Methods
    Type Params | Return Type | Name and description
    --- | --- | ---
    `<A extends Annotation>` | `public A` | `findAnnotationOnBean(java.lang.String beanName, java.lang.Class<A> annotationType)` Find a java.lang.annotation.Annotation of `annotationType` on the specified bean, traversing its interfaces and super classes if no annotation can be found on the given class itself, as well as checking its raw bean class if not found on the exposed bean reference (e.g. in case of a proxy).
    `<T>` | `public T` | `getBean(java.lang.String name)` See Also: org.springframework.beans.factory.BeanFactory#getBean(String)
    `<T>` | `public T` | `getBean(java.lang.String name, java.lang.Class<T> requiredType)` See Also: org.springframework.beans.factory.BeanFactory#getBean(String, Class)
    `` | `public final org.springframework.beans.factory.ListableBeanFactory` | `getBeanFactory()` Return the wrapped org.springframework.beans.factory.ListableBeanFactory.
    `<T>` | `public java.util.Map<java.lang.String, T>` | `getBeansOfType(java.lang.Class<T> type)` See Also: org.springframework.beans.factory.ListableBeanFactory#getBeansOfType(java.lang.Class)
    `<T>` | `public java.util.Map<java.lang.String, T>` | `getBeansOfType(java.lang.Class<T> type, boolean includeNonSingletons, boolean allowEagerInit)` See Also: org.springframework.beans.factory.ListableBeanFactory#getBeansOfType(java.lang.Class, boolean, boolean)
    `` | `public java.util.Map<java.lang.String, java.lang.Object>` | `getBeansWithAnnotation(java.lang.Class<? extends java.lang.annotation.Annotation> annotationType)` Find all beans whose `Class` has the supplied java.lang.annotation.Annotation type.

  - ### Inherited Methods Summary

    Inherited Methods
    Methods inherited from class | Name
    --- | ---
    `class java.lang.Object` | `java.lang.Object#wait(long), java.lang.Object#wait(long, int), java.lang.Object#wait(), java.lang.Object#equals(java.lang.Object), java.lang.Object#toString(), java.lang.Object#hashCode(), java.lang.Object#getClass(), java.lang.Object#notify(), java.lang.Object#notifyAll()`

- - ### Field Detail

    - #### private final org.springframework.beans.factory.ListableBeanFactory beanFactory

      The org.springframework.beans.factory.ListableBeanFactory being wrapped.

  - ### Constructor Detail

    - #### public GenericBeanFactoryAccessor(org.springframework.beans.factory.ListableBeanFactory beanFactory)

      Constructs a `GenericBeanFactoryAccessor` that wraps the supplied org.springframework.beans.factory.ListableBeanFactory.

  - ### Method Detail

    - #### <A extends Annotation> public A findAnnotationOnBean(java.lang.String beanName, java.lang.Class<A> annotationType)

      Find a java.lang.annotation.Annotation of `annotationType` on the specified bean, traversing its interfaces and super classes if no annotation can be found on the given class itself, as well as checking its raw bean class if not found on the exposed bean reference (e.g. in case of a proxy).

      Parameters:
        `beanName` - the name of the bean to look for annotations on
        `annotationType` - the annotation class to look for
      Returns:
        the annotation of the given type found, or `null`
      See Also:
        org.springframework.core.annotation.AnnotationUtils#findAnnotation(Class, Class)

    - #### <T> @java.lang.SuppressWarnings("unchecked") public T getBean(java.lang.String name)

      See Also:
        org.springframework.beans.factory.BeanFactory#getBean(String)

    - #### <T> public T getBean(java.lang.String name, java.lang.Class<T> requiredType)

      See Also:
        org.springframework.beans.factory.BeanFactory#getBean(String, Class)

    - #### public final org.springframework.beans.factory.ListableBeanFactory getBeanFactory()

      Return the wrapped org.springframework.beans.factory.ListableBeanFactory.

    - #### <T> public java.util.Map<java.lang.String, T> getBeansOfType(java.lang.Class<T> type)

      See Also:
        org.springframework.beans.factory.ListableBeanFactory#getBeansOfType(java.lang.Class)

    - #### <T> public java.util.Map<java.lang.String, T> getBeansOfType(java.lang.Class<T> type, boolean includeNonSingletons, boolean allowEagerInit)

      See Also:
        org.springframework.beans.factory.ListableBeanFactory#getBeansOfType(java.lang.Class, boolean, boolean)

    - #### public java.util.Map<java.lang.String, java.lang.Object> getBeansWithAnnotation(java.lang.Class<? extends java.lang.annotation.Annotation> annotationType)

      Find all beans whose `Class` has the supplied java.lang.annotation.Annotation type.

      Parameters:
        `annotationType` - the type of annotation to look for
      Returns:
        a Map with the matching beans, containing the bean names as keys and the corresponding bean instances as values