类 JndiObjectTargetSource
- 所有已实现的接口:
TargetClassAware,TargetSource,InitializingBean
TargetSource that provides
configurable JNDI lookups for getTarget() calls.
Can be used as alternative to JndiObjectFactoryBean, to allow for
relocating a JNDI object lazily or for each operation (see "lookupOnStartup"
and "cache" properties). This is particularly useful during development, as it
allows for hot restarting of the JNDI server (for example, a remote JMS server).
Example:
<bean id="queueConnectionFactoryTarget" class="cn.taketoday.jndi.JndiObjectTargetSource"> <property name="jndiName" value="JmsQueueConnectionFactory"/> <property name="lookupOnStartup" value="false"/> </bean> <bean id="queueConnectionFactory" class="cn.taketoday.aop.framework.ProxyFactoryBean"> <property name="proxyInterfaces" value="jakarta.jms.QueueConnectionFactory"/> <property name="targetSource" ref="queueConnectionFactoryTarget"/> </bean>A
createQueueConnection call on the "queueConnectionFactory" proxy will
cause a lazy JNDI lookup for "JmsQueueConnectionFactory" and a subsequent delegating
call to the retrieved QueueConnectionFactory's createQueueConnection.
Alternatively, use a JndiObjectFactoryBean with a "proxyInterface".
"lookupOnStartup" and "cache" can then be specified on the JndiObjectFactoryBean,
creating a JndiObjectTargetSource underneath (instead of defining separate
ProxyFactoryBean and JndiObjectTargetSource beans).
- 从以下版本开始:
- 4.0
- 作者:
- Juergen Hoeller
- 另请参阅:
-
字段概要
从类继承的字段 cn.taketoday.jndi.JndiLocatorSupport
CONTAINER_PREFIX从类继承的字段 cn.taketoday.jndi.JndiAccessor
logger -
构造器概要
构造器 -
方法概要
修饰符和类型方法说明voidClass<?>booleanisStatic()voidreleaseTarget(Object target) voidsetCache(boolean cache) Set whether to cache the JNDI object once it has been located.voidsetLookupOnStartup(boolean lookupOnStartup) Set whether to look up the JNDI object on startup.从类继承的方法 cn.taketoday.jndi.JndiObjectLocator
getExpectedType, getJndiName, lookup, setExpectedType, setJndiName从类继承的方法 cn.taketoday.jndi.JndiLocatorSupport
convertJndiName, isResourceRef, lookup, lookup, setResourceRef从类继承的方法 cn.taketoday.jndi.JndiAccessor
getJndiEnvironment, getJndiTemplate, setJndiEnvironment, setJndiTemplate
-
构造器详细资料
-
JndiObjectTargetSource
public JndiObjectTargetSource()
-
-
方法详细资料
-
setLookupOnStartup
public void setLookupOnStartup(boolean lookupOnStartup) Set whether to look up the JNDI object on startup. Default is "true".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.
- 另请参阅:
-
setCache
public void setCache(boolean cache) Set whether to cache the JNDI object once it has been located. Default is "true".Can be turned off to allow for hot redeployment of JNDI objects. In this case, the JNDI object will be fetched for each invocation.
-
afterPropertiesSet
- 指定者:
afterPropertiesSet在接口中InitializingBean- 覆盖:
afterPropertiesSet在类中JndiObjectLocator- 抛出:
NamingException
-
getTargetClass
- 指定者:
getTargetClass在接口中TargetClassAware- 指定者:
getTargetClass在接口中TargetSource
-
isStatic
public boolean isStatic()- 指定者:
isStatic在接口中TargetSource
-
getTarget
- 指定者:
getTarget在接口中TargetSource
-
releaseTarget
- 指定者:
releaseTarget在接口中TargetSource
-