org.springframework.context.access
Class ContextJndiBeanFactoryLocator
java.lang.Object
org.springframework.jndi.JndiAccessor
org.springframework.jndi.JndiLocatorSupport
org.springframework.context.access.ContextJndiBeanFactoryLocator
- All Implemented Interfaces:
- org.springframework.beans.factory.access.BeanFactoryLocator
public class ContextJndiBeanFactoryLocator
- extends JndiLocatorSupport
- implements org.springframework.beans.factory.access.BeanFactoryLocator
BeanFactoryLocator implementation that creates the BeanFactory from one or
more classpath locations specified in a JNDI environment variable.
This default implementation creates a
ClassPathXmlApplicationContext
.
Subclasses may override createBeanFactory(java.lang.String[])
for custom instantiation.
- Author:
- Colin Sampaleanu, Juergen Hoeller
- See Also:
createBeanFactory(java.lang.String[])
Field Summary |
static java.lang.String |
BEAN_FACTORY_PATH_DELIMITERS
Any number of these characters are considered delimiters between
multiple bean factory config paths in a single String value. |
Method Summary |
protected ApplicationContext |
createApplicationContext(java.lang.String[] resources)
Create the ApplicationContext instance, given an array of class path resource
Strings which should be combined |
protected org.springframework.beans.factory.access.BeanFactoryReference |
createBeanFactory(java.lang.String[] resources)
Create the BeanFactory instance, given an array of class path resource Strings
which should be combined. |
org.springframework.beans.factory.access.BeanFactoryReference |
useBeanFactory(java.lang.String factoryKey)
Load/use a bean factory, as specified by a factory key which is a JNDI
address, of the form java:comp/env/ejb/BeanFactoryPath . |
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
BEAN_FACTORY_PATH_DELIMITERS
public static final java.lang.String BEAN_FACTORY_PATH_DELIMITERS
- Any number of these characters are considered delimiters between
multiple bean factory config paths in a single String value.
- See Also:
- Constant Field Values
ContextJndiBeanFactoryLocator
public ContextJndiBeanFactoryLocator()
useBeanFactory
public org.springframework.beans.factory.access.BeanFactoryReference useBeanFactory(java.lang.String factoryKey)
throws org.springframework.beans.BeansException
- Load/use a bean factory, as specified by a factory key which is a JNDI
address, of the form
java:comp/env/ejb/BeanFactoryPath
. The
contents of this JNDI location must be a string containing one or more
classpath resource names (separated by any of the delimiters ',; \t\n
'
if there is more than one. The resulting BeanFactory (or ApplicationContext)
will be created from the combined resources.
- Specified by:
useBeanFactory
in interface org.springframework.beans.factory.access.BeanFactoryLocator
- Throws:
org.springframework.beans.BeansException
- See Also:
createBeanFactory(java.lang.String[])
createBeanFactory
protected org.springframework.beans.factory.access.BeanFactoryReference createBeanFactory(java.lang.String[] resources)
throws org.springframework.beans.BeansException
- Create the BeanFactory instance, given an array of class path resource Strings
which should be combined. This is split out as a separate method so that
subclasses can override the actual BeanFactory implementation class.
Delegates to createApplicationContext
by default,
wrapping the result in a ContextBeanFactoryReference.
- Parameters:
resources
- an array of Strings representing classpath resource names
- Returns:
- the created BeanFactory, wrapped in a BeanFactoryReference
(for example, a ContextBeanFactoryReference wrapping an ApplicationContext)
- Throws:
org.springframework.beans.BeansException
- if factory creation failed- See Also:
createApplicationContext(java.lang.String[])
,
ContextBeanFactoryReference
createApplicationContext
protected ApplicationContext createApplicationContext(java.lang.String[] resources)
throws org.springframework.beans.BeansException
- Create the ApplicationContext instance, given an array of class path resource
Strings which should be combined
- Parameters:
resources
- an array of Strings representing classpath resource names
- Returns:
- the created ApplicationContext
- Throws:
org.springframework.beans.BeansException
- if context creation failed