Class JndiLocatorSupport
- Direct Known Subclasses:
- JndiDataSourceLookup, JndiDestinationResolver, JndiLocatorDelegate, JndiObjectLocator, SimpleJndiBeanFactory
JNDI names may or may not include the "java:comp/env/" prefix expected by Jakarta EE applications when accessing a locally mapped (ENC - Environmental Naming Context) resource. If it doesn't, the "java:comp/env/" prefix will be prepended if the "resourceRef" property is true (the default is false) and no other scheme (for example, "java:") is given.
- Since:
- 1.1
- Author:
- Juergen Hoeller
- See Also:
- 
Field SummaryFieldsFields inherited from class JndiAccessorlogger
- 
Constructor SummaryConstructors
- 
Method SummaryModifier and TypeMethodDescriptionprotected StringconvertJndiName(String jndiName) Convert the given JNDI name into the actual JNDI name to use.booleanReturn whether the lookup occurs in a Jakarta EE container.protected ObjectPerform an actual JNDI lookup for the given name via the JndiTemplate.protected <T> TPerform an actual JNDI lookup for the given name via the JndiTemplate.voidsetResourceRef(boolean resourceRef) Set whether the lookup occurs in a Jakarta EE container, i.e.Methods inherited from class JndiAccessorgetJndiEnvironment, getJndiTemplate, setJndiEnvironment, setJndiTemplate
- 
Field Details- 
CONTAINER_PREFIX
 
- 
- 
Constructor Details- 
JndiLocatorSupportpublic JndiLocatorSupport()
 
- 
- 
Method Details- 
setResourceRefpublic void setResourceRef(boolean resourceRef) Set whether the lookup occurs in a Jakarta EE container, i.e. if the prefix "java:comp/env/" needs to be added if the JNDI name doesn't already contain it. Default is "false".Note: Will only get applied if no other scheme (for example, "java:") is given. 
- 
isResourceRefpublic boolean isResourceRef()Return whether the lookup occurs in a Jakarta EE container.
- 
lookupPerform 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". - Parameters:
- jndiName- the JNDI name to look up
- Returns:
- the obtained object
- Throws:
- NamingException- if the JNDI lookup failed
- See Also:
 
- 
lookupPerform 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". - 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:
 
- 
convertJndiNameConvert the given JNDI name into the actual JNDI name to use.The default implementation applies the "java:comp/env/" prefix if "resourceRef" is "true" and no other scheme (for example, "java:") is given. - Parameters:
- jndiName- the original JNDI name
- Returns:
- the JNDI name to use
- See Also:
 
 
-