Class JndiLocatorDelegate
JndiLocatorSupport subclass with public lookup methods,
for convenient use as a delegate.- Since:
- 3.0.1
- Author:
- Juergen Hoeller
- 
Field SummaryFieldsModifier and TypeFieldDescriptionstatic final StringSystem property that instructs Spring to ignore a default JNDI environment, i.e.Fields inherited from class JndiLocatorSupportCONTAINER_PREFIXFields inherited from class JndiAccessorlogger
- 
Constructor SummaryConstructors
- 
Method SummaryModifier and TypeMethodDescriptionstatic JndiLocatorDelegateConfigure aJndiLocatorDelegatewith its "resourceRef" property set totrue, meaning that all names will be prefixed with "java:comp/env/".static booleanCheck whether a default JNDI environment, as in a Jakarta EE environment, is available on this JVM.Perform an actual JNDI lookup for the given name via the JndiTemplate.<T> TPerform an actual JNDI lookup for the given name via the JndiTemplate.Methods inherited from class JndiLocatorSupportconvertJndiName, isResourceRef, setResourceRefMethods inherited from class JndiAccessorgetJndiEnvironment, getJndiTemplate, setJndiEnvironment, setJndiTemplate
- 
Field Details- 
IGNORE_JNDI_PROPERTY_NAMESystem property that instructs Spring to ignore a default JNDI environment, i.e. to always returnfalsefromisDefaultJndiEnvironmentAvailable().The default is "false", allowing for regular default JNDI access, for example, in JndiPropertySource. Switching this flag totrueis 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 DataSourceor some other environment resource. The flag literally just affects code which attempts JNDI searches based on theJndiLocatorDelegate.isDefaultJndiEnvironmentAvailable()check: in particular,StandardServletEnvironment.- Since:
- 4.3
- See Also:
 
 
- 
- 
Constructor Details- 
JndiLocatorDelegatepublic JndiLocatorDelegate()
 
- 
- 
Method Details- 
lookupDescription copied from class:JndiLocatorSupportPerform 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". - Overrides:
- lookupin class- JndiLocatorSupport
- Parameters:
- jndiName- the JNDI name to look up
- Returns:
- the obtained object
- Throws:
- NamingException- if the JNDI lookup failed
- See Also:
 
- 
lookupDescription copied from class:JndiLocatorSupportPerform 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". - Overrides:
- lookupin class- JndiLocatorSupport
- Parameters:
- jndiName- the JNDI name to look up
- requiredType- the required type of the object
- Returns:
- the obtained object
- Throws:
- NamingException- if the JNDI lookup failed
- See Also:
 
- 
createDefaultResourceRefLocatorConfigure aJndiLocatorDelegatewith its "resourceRef" property set totrue, meaning that all names will be prefixed with "java:comp/env/".- See Also:
 
- 
isDefaultJndiEnvironmentAvailablepublic static boolean isDefaultJndiEnvironmentAvailable()Check whether a default JNDI environment, as in a Jakarta EE environment, is available on this JVM.- Returns:
- trueif a default InitialContext can be used,- falseif not
 
 
-