org.springframework.jndi.support

## 类 SimpleJndiBeanFactory

- java.lang.Object
- - org.springframework.jndi.JndiAccessor
  - - org.springframework.jndi.JndiLocatorSupport
    - - org.springframework.jndi.support.SimpleJndiBeanFactory

- 所有已实现的接口:
    org.springframework.beans.factory.BeanFactory

      public class SimpleJndiBeanFactory
      extends JndiLocatorSupport
      implements org.springframework.beans.factory.BeanFactory

  Simple JNDI-based implementation of Spring's `BeanFactory` interface. Does not support enumerating bean definitions, hence doesn't implement the `ListableBeanFactory` interface.

  This factory resolves given bean names as JNDI names within the Java EE application's "java:comp/env/" namespace. It caches the resolved types for all obtained objects, and optionally also caches shareable objects (if they are explicitly marked as `shareable resource`.

  The main intent of this factory is usage in combination with Spring's `CommonAnnotationBeanPostProcessor`, configured as "resourceFactory" for resolving `@Resource` annotations as JNDI objects without intermediate bean definitions. It may be used for similar lookup scenarios as well, of course, in particular if BeanFactory-style type checking is required.

  从以下版本开始:
    2.5
  作者:
    Juergen Hoeller
  另请参阅:
    `DefaultListableBeanFactory`, `CommonAnnotationBeanPostProcessor`

- - ### 字段概要

    - ### 从类继承的字段 org.springframework.jndi.JndiLocatorSupport

      `CONTAINER_PREFIX`

    - ### 从类继承的字段 org.springframework.jndi.JndiAccessor

      `logger`

    - ### 从接口继承的字段 org.springframework.beans.factory.BeanFactory

      `FACTORY_BEAN_PREFIX`

  - ### 构造器概要

    构造器
    构造器和说明
    `SimpleJndiBeanFactory()`

  - ### 方法概要

    所有方法 实例方法 具体方法
    限定符和类型 | 方法和说明
    --- | ---
    `void` | `addShareableResource(String shareableResource)` Add the name of a shareable JNDI resource, which this factory is allowed to cache once obtained.
    `boolean` | `containsBean(String name)`
    `String[]` | `getAliases(String name)`
    `<T> T` | `getBean(Class<T> requiredType)`
    `<T> T` | `getBean(Class<T> requiredType, Object... args)`
    `Object` | `getBean(String name)`
    `<T> T` | `getBean(String name, Class<T> requiredType)`
    `Object` | `getBean(String name, Object... args)`
    `Class<?>` | `getType(String name)`
    `boolean` | `isPrototype(String name)`
    `boolean` | `isSingleton(String name)`
    `boolean` | `isTypeMatch(String name, Class<?> typeToMatch)`
    `boolean` | `isTypeMatch(String name, org.springframework.core.ResolvableType typeToMatch)`
    `void` | `setShareableResources(String... shareableResources)` Set a list of names of shareable JNDI resources, which this factory is allowed to cache once obtained.

    - ### 从类继承的方法 org.springframework.jndi.JndiLocatorSupport

      `convertJndiName, isResourceRef, lookup, lookup, setResourceRef`

    - ### 从类继承的方法 org.springframework.jndi.JndiAccessor

      `getJndiEnvironment, getJndiTemplate, setJndiEnvironment, setJndiTemplate`

    - ### 从类继承的方法 java.lang.Object

      `clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

- - ### 构造器详细资料

    - #### SimpleJndiBeanFactory

          public SimpleJndiBeanFactory()

  - ### 方法详细资料

    - #### addShareableResource

          public void addShareableResource(String shareableResource)

      Add the name of a shareable JNDI resource, which this factory is allowed to cache once obtained.
      参数:
        `shareableResource` - the JNDI name (typically within the "java:comp/env/" namespace)

    - #### setShareableResources

          public void setShareableResources(String... shareableResources)

      Set a list of names of shareable JNDI resources, which this factory is allowed to cache once obtained.
      参数:
        `shareableResources` - the JNDI names (typically within the "java:comp/env/" namespace)

    - #### getBean

          public Object getBean(String name)
                         throws org.springframework.beans.BeansException

      指定者:
        `getBean` 在接口中 `org.springframework.beans.factory.BeanFactory`
      抛出:
        `org.springframework.beans.BeansException`

    - #### getBean

          public <T> T getBean(String name,
                               @Nullable
                               Class<T> requiredType)
                        throws org.springframework.beans.BeansException

      指定者:
        `getBean` 在接口中 `org.springframework.beans.factory.BeanFactory`
      抛出:
        `org.springframework.beans.BeansException`

    - #### getBean

          public Object getBean(String name,
                                @Nullable
                                Object... args)
                         throws org.springframework.beans.BeansException

      指定者:
        `getBean` 在接口中 `org.springframework.beans.factory.BeanFactory`
      抛出:
        `org.springframework.beans.BeansException`

    - #### getBean

          public <T> T getBean(Class<T> requiredType)
                        throws org.springframework.beans.BeansException

      指定者:
        `getBean` 在接口中 `org.springframework.beans.factory.BeanFactory`
      抛出:
        `org.springframework.beans.BeansException`

    - #### getBean

          public <T> T getBean(Class<T> requiredType,
                               @Nullable
                               Object... args)
                        throws org.springframework.beans.BeansException

      指定者:
        `getBean` 在接口中 `org.springframework.beans.factory.BeanFactory`
      抛出:
        `org.springframework.beans.BeansException`

    - #### containsBean

          public boolean containsBean(String name)

      指定者:
        `containsBean` 在接口中 `org.springframework.beans.factory.BeanFactory`

    - #### isSingleton

          public boolean isSingleton(String name)
                              throws org.springframework.beans.factory.NoSuchBeanDefinitionException

      指定者:
        `isSingleton` 在接口中 `org.springframework.beans.factory.BeanFactory`
      抛出:
        `org.springframework.beans.factory.NoSuchBeanDefinitionException`

    - #### isPrototype

          public boolean isPrototype(String name)
                              throws org.springframework.beans.factory.NoSuchBeanDefinitionException

      指定者:
        `isPrototype` 在接口中 `org.springframework.beans.factory.BeanFactory`
      抛出:
        `org.springframework.beans.factory.NoSuchBeanDefinitionException`

    - #### isTypeMatch

          public boolean isTypeMatch(String name,
                                     org.springframework.core.ResolvableType typeToMatch)
                              throws org.springframework.beans.factory.NoSuchBeanDefinitionException

      指定者:
        `isTypeMatch` 在接口中 `org.springframework.beans.factory.BeanFactory`
      抛出:
        `org.springframework.beans.factory.NoSuchBeanDefinitionException`

    - #### isTypeMatch

          public boolean isTypeMatch(String name,
                                     @Nullable
                                     Class<?> typeToMatch)
                              throws org.springframework.beans.factory.NoSuchBeanDefinitionException

      指定者:
        `isTypeMatch` 在接口中 `org.springframework.beans.factory.BeanFactory`
      抛出:
        `org.springframework.beans.factory.NoSuchBeanDefinitionException`

    - #### getType

          @Nullable
          public Class<?> getType(String name)
                                      throws org.springframework.beans.factory.NoSuchBeanDefinitionException

      指定者:
        `getType` 在接口中 `org.springframework.beans.factory.BeanFactory`
      抛出:
        `org.springframework.beans.factory.NoSuchBeanDefinitionException`

    - #### getAliases

          public String[] getAliases(String name)

      指定者:
        `getAliases` 在接口中 `org.springframework.beans.factory.BeanFactory`