org.springframework.jndi
Class JndiObjectFactoryBean
org.springframework.jndi.AbstractJndiLocator
|
+--org.springframework.jndi.JndiObjectFactoryBean
- public class JndiObjectFactoryBean
- extends AbstractJndiLocator
- implements FactoryBean
FactoryBean that looks up a JNDI object. Behaves like the object when
used as bean reference, e.g. for JdbcTemplate's dataSource property.
The typical usage will be to register this as singleton factory
(e.g. for a certain JNDI DataSource) in an application context,
and give bean references to application services that need it.
Of course, service implementations can lookup e.g. a DataSource from
JNDI themselves, but this class enables central configuration of the
JNDI name, and easy switching to non-JNDI replacements. The latter can
be used for test setups, standalone clients, etc.
Note that switching to e.g. DriverManagerDataSource is just a matter
of configuration: replace the definition of this FactoryBean with a
DriverManagerDataSource definition!
- Author:
- Juergen Hoeller
- Since: 22.05.2003
- See Also: org.springframework.jdbc.support.JdbcAccessor.setDataSource(javax.sql.DataSource)
getObject
public Object getObject()
- Return the singleton JNDI object.
getObjectType
public Class getObjectType()
isSingleton
public boolean isSingleton()