Class JndiObjectLocator
- All Implemented Interfaces:
- InitializingBean
- Direct Known Subclasses:
- JndiObjectFactoryBean,- JndiObjectTargetSource
Exposes a "jndiName" property. This may or may not
 include the "java:comp/env/" prefix expected by Jakarta EE applications when
 accessing a locally mapped (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.
 
Subclasses may invoke the lookup() method whenever it is appropriate.
 Some classes might do this on initialization, while others might do it
 on demand. The latter strategy is more flexible in that it allows for
 initialization of the locator before the JNDI object is available.
- 
Field SummaryFields inherited from class org.springframework.jndi.JndiLocatorSupportCONTAINER_PREFIXFields inherited from class org.springframework.jndi.JndiAccessorlogger
- 
Constructor SummaryConstructors
- 
Method SummaryModifier and TypeMethodDescriptionvoidInvoked by the containingBeanFactoryafter it has set all bean properties and satisfiedBeanFactoryAware,ApplicationContextAwareetc.Class<?>Return the type that the located JNDI object is supposed to be assignable to, if any.Return the JNDI name to look up.protected Objectlookup()Perform the actual JNDI lookup for this locator's target resource.voidsetExpectedType(Class<?> expectedType) Specify the type that the located JNDI object is supposed to be assignable to, if any.voidsetJndiName(String jndiName) Specify the JNDI name to look up.Methods inherited from class org.springframework.jndi.JndiLocatorSupportconvertJndiName, isResourceRef, lookup, lookup, setResourceRefMethods inherited from class org.springframework.jndi.JndiAccessorgetJndiEnvironment, getJndiTemplate, setJndiEnvironment, setJndiTemplate
- 
Constructor Details- 
JndiObjectLocatorpublic JndiObjectLocator()
 
- 
- 
Method Details- 
setJndiNameSpecify the JNDI name to look up. If it doesn't begin with "java:comp/env/" this prefix is added automatically if "resourceRef" is set to "true".- Parameters:
- jndiName- the JNDI name to look up
- See Also:
 
- 
getJndiNameReturn the JNDI name to look up.
- 
setExpectedTypeSpecify the type that the located JNDI object is supposed to be assignable to, if any.
- 
getExpectedTypeReturn the type that the located JNDI object is supposed to be assignable to, if any.
- 
afterPropertiesSetDescription copied from interface:InitializingBeanInvoked by the containingBeanFactoryafter it has set all bean properties and satisfiedBeanFactoryAware,ApplicationContextAwareetc.This method allows the bean instance to perform validation of its overall configuration and final initialization when all bean properties have been set. - Specified by:
- afterPropertiesSetin interface- InitializingBean
- Throws:
- IllegalArgumentException
- NamingException
 
- 
lookupPerform the actual JNDI lookup for this locator's target resource.- Returns:
- the located target object
- Throws:
- NamingException- if the JNDI lookup failed or if the located JNDI object is not assignable to the expected type
- See Also:
 
 
-