org.springframework.jndi

## 类 JndiLocatorDelegate

- java.lang.Object
- - org.springframework.jndi.JndiAccessor
  - - org.springframework.jndi.JndiLocatorSupport
    - - org.springframework.jndi.JndiLocatorDelegate

-     public class JndiLocatorDelegate
      extends JndiLocatorSupport

  `JndiLocatorSupport` subclass with public lookup methods, for convenient use as a delegate.
  从以下版本开始:
    3.0.1
  作者:
    Juergen Hoeller

- - ### 字段概要

    字段
    限定符和类型 | 字段和说明
    --- | ---
    `static String` | `IGNORE_JNDI_PROPERTY_NAME` System property that instructs Spring to ignore a default JNDI environment, i.e.

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

      `CONTAINER_PREFIX`

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

      `logger`

  - ### 构造器概要

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

  - ### 方法概要

    所有方法 静态方法 实例方法 具体方法
    限定符和类型 | 方法和说明
    --- | ---
    `static JndiLocatorDelegate` | `createDefaultResourceRefLocator()` Configure a `JndiLocatorDelegate` with its "resourceRef" property set to `true`, meaning that all names will be prefixed with "java:comp/env/".
    `static boolean` | `isDefaultJndiEnvironmentAvailable()` Check whether a default JNDI environment, as in a Java EE environment, is available on this JVM.
    `Object` | `lookup(String jndiName)` Perform an actual JNDI lookup for the given name via the JndiTemplate.
    `<T> T` | `lookup(String jndiName, Class<T> requiredType)` Perform an actual JNDI lookup for the given name via the JndiTemplate.

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

      `convertJndiName, isResourceRef, setResourceRef`

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

      `getJndiEnvironment, getJndiTemplate, setJndiEnvironment, setJndiTemplate`

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

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

- - ### 字段详细资料

    - #### IGNORE_JNDI_PROPERTY_NAME

          public static final String IGNORE_JNDI_PROPERTY_NAME

      System property that instructs Spring to ignore a default JNDI environment, i.e. to always return `false` from `isDefaultJndiEnvironmentAvailable()`.

      The default is "false", allowing for regular default JNDI access e.g. in `JndiPropertySource`. Switching this flag to `true` is an optimization for scenarios where nothing is ever to be found for such JNDI fallback searches to begin with, avoiding the repeated JNDI lookup overhead.

      Note that this flag just affects JNDI fallback searches, not explicitly configured JNDI lookups such as for a `DataSource` or some other environment resource. The flag literally just affects code which attempts JNDI searches based on the `JndiLocatorDelegate.isDefaultJndiEnvironmentAvailable()` check: in particular, `StandardServletEnvironment` and `StandardPortletEnvironment`.

      从以下版本开始:
        4.3
      另请参阅:
        `isDefaultJndiEnvironmentAvailable()`, `JndiPropertySource`, 常量字段值

  - ### 构造器详细资料

    - #### JndiLocatorDelegate

          public JndiLocatorDelegate()

  - ### 方法详细资料

    - #### lookup

          public Object lookup(String jndiName)
                        throws NamingException

      从类复制的说明: `JndiLocatorSupport`
      Perform an actual JNDI lookup for the given name via the JndiTemplate.

      If the name doesn't begin with "java:comp/env/", this prefix is added if "resourceRef" is set to "true".

      覆盖:
        `lookup` 在类中 `JndiLocatorSupport`
      参数:
        `jndiName` - the JNDI name to look up
      返回:
        the obtained object
      抛出:
        `NamingException` - if the JNDI lookup failed
      另请参阅:
        `JndiLocatorSupport.setResourceRef(boolean)`

    - #### lookup

          public <T> T lookup(String jndiName,
                              @Nullable
                              Class<T> requiredType)
                       throws NamingException

      从类复制的说明: `JndiLocatorSupport`
      Perform an actual JNDI lookup for the given name via the JndiTemplate.

      If the name doesn't begin with "java:comp/env/", this prefix is added if "resourceRef" is set to "true".

      覆盖:
        `lookup` 在类中 `JndiLocatorSupport`
      参数:
        `jndiName` - the JNDI name to look up
        `requiredType` - the required type of the object
      返回:
        the obtained object
      抛出:
        `NamingException` - if the JNDI lookup failed
      另请参阅:
        `JndiLocatorSupport.setResourceRef(boolean)`

    - #### createDefaultResourceRefLocator

          public static JndiLocatorDelegate createDefaultResourceRefLocator()

      Configure a `JndiLocatorDelegate` with its "resourceRef" property set to `true`, meaning that all names will be prefixed with "java:comp/env/".
      另请参阅:
        `JndiLocatorSupport.setResourceRef(boolean)`

    - #### isDefaultJndiEnvironmentAvailable

          public static boolean isDefaultJndiEnvironmentAvailable()

      Check whether a default JNDI environment, as in a Java EE environment, is available on this JVM.
      返回:
        `true` if a default InitialContext can be used, `false` if not