java.lang.Objectorg.springframework.jndi.JndiAccessor
org.springframework.jndi.JndiLocatorSupport
org.springframework.jndi.JndiObjectLocator
org.springframework.jndi.JndiObjectFactoryBean
All Implemented Interfaces:
BeanClassLoaderAware, FactoryBean, InitializingBean
The typical usage will be to register this as singleton factory (e.g. for a certain JNDI-bound DataSource) in an application context, and give bean references to application services that need it.
The default behavior is to look up the JNDI object on startup and cache it. This can be customized through the "lookupOnStartup" and "cache" properties, using a JndiObjectTargetSource underneath. Note that you need to specify a "proxyInterface" in such a scenario, since the actual JNDI object type is not known in advance.
Of course, bean classes in a Spring environment may lookup e.g. a DataSource from JNDI themselves. This class simply enables central configuration of the JNDI name, and easy switching to non-JNDI alternatives. The latter is particularly convenient for test setups, reuse in standalone clients, etc.
Note that switching to e.g. DriverManagerDataSource is just a matter of configuration: Simply replace the definition of this FactoryBean with a org.springframework.jdbc.datasource.DriverManagerDataSource definition!
Juergen - Hoeller22.05.2003 - | Fields inherited from org.springframework.jndi.JndiLocatorSupport: |
|---|
| CONTAINER_PREFIX |
| Fields inherited from org.springframework.jndi.JndiAccessor: |
|---|
| logger |
| Method from org.springframework.jndi.JndiObjectFactoryBean Summary: |
|---|
| afterPropertiesSet, createCompositeInterface, getObject, getObjectType, isSingleton, lookupWithFallback, setBeanClassLoader, setCache, setDefaultObject, setExposeAccessContext, setLookupOnStartup, setProxyInterface, setProxyInterfaces |
| Methods from org.springframework.jndi.JndiObjectLocator: |
|---|
| afterPropertiesSet, getExpectedType, getJndiName, lookup, setExpectedType, setJndiName |
| Methods from org.springframework.jndi.JndiLocatorSupport: |
|---|
| convertJndiName, isResourceRef, lookup, lookup, setResourceRef |
| Methods from org.springframework.jndi.JndiAccessor: |
|---|
| getJndiEnvironment, getJndiTemplate, setJndiEnvironment, setJndiTemplate |
| Methods from java.lang.Object: |
|---|
| equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Method from org.springframework.jndi.JndiObjectFactoryBean Detail: |
|---|
|
The default implementation builds a JDK proxy class for the given interfaces. |
|
|
|
|
|
Can be turned off to allow for hot redeployment of JNDI objects. In this case, the JNDI object will be fetched for each invocation. For hot redeployment, a proxy interface needs to be specified. |
This can be an arbitrary bean reference or literal value. It is typically used for literal values in scenarios where the JNDI environment might define specific config settings but those are not required to be present. Note: This is only supported for lookup on startup. |
Default is "false", i.e. to only expose the JNDI context for object lookup. Switch this flag to "true" in order to expose the JNDI environment (including the authorization context) for each method invocation, as needed by WebLogic for JNDI-obtained factories (e.g. JDBC DataSource, JMS ConnectionFactory) with authorization requirements. |
Can be turned off to allow for late availability of the JNDI object. In this case, the JNDI object will be fetched on first access. For a lazy lookup, a proxy interface needs to be specified. |
Typically used in conjunction with "lookupOnStartup"=false and/or "cache"=false. Needs to be specified because the actual JNDI object type is not known in advance in case of a lazy lookup. |
Typically used in conjunction with "lookupOnStartup"=false and/or "cache"=false. Note that proxy interfaces will be autodetected from a specified "expectedType", if necessary. |