public class SpringConfigurationProcessor extends java.lang.Object implements ConfigurationProcessor
A ConfigurationProcessor
that uses a spring XML file to emulate the XmlConfiguration
format.
XmlConfiguration
expects a primary object that is either passed in to a call to configure(Object)
or that is constructed by a call to configure()
. This processor looks for a bean definition
with an id, name or alias of "Main" as uses that as the primary bean.
The objects mapped by XmlConfiguration.getIdMap()
are set as singletons before any configuration calls
and if the spring configuration file contains a definition for the singleton id, the the singleton is updated
with a call to AbstractAutowireCapableBeanFactory.configureBean(Object, String)
.
The property map obtained via XmlConfiguration.getProperties()
is set as a singleton called "properties"
and values can be accessed by somewhat verbose
usage of MethodInvokingFactoryBean
.
This processor is returned by the SpringConfigurationProcessorFactory
for any XML document whos first
element is "beans". The factory is discovered by a ServiceLoader
for ConfigurationProcessorFactory
.
Modifier and Type | Field and Description |
---|---|
private org.springframework.beans.factory.support.DefaultListableBeanFactory |
_beanFactory |
private XmlConfiguration |
_configuration |
private java.lang.String |
_main |
private static Logger |
LOG |
Constructor and Description |
---|
SpringConfigurationProcessor() |
Modifier and Type | Method and Description |
---|---|
java.lang.Object |
configure()
Return a configured bean.
|
java.lang.Object |
configure(java.lang.Object obj) |
private void |
doConfigure() |
void |
init(Resource jettyResource,
XmlParser.Node config,
XmlConfiguration configuration)
Initialize a ConfigurationProcessor from provided Resource and XML
|
void |
init(java.net.URL url,
XmlParser.Node root,
XmlConfiguration configuration) |
private static final Logger LOG
private XmlConfiguration _configuration
private org.springframework.beans.factory.support.DefaultListableBeanFactory _beanFactory
private java.lang.String _main
public void init(java.net.URL url, XmlParser.Node root, XmlConfiguration configuration)
init
in interface ConfigurationProcessor
public void init(Resource jettyResource, XmlParser.Node config, XmlConfiguration configuration)
ConfigurationProcessor
init
in interface ConfigurationProcessor
jettyResource
- the resource being readconfig
- the parsed XML root node for the resourceconfiguration
- the configuration being used (typically for ref IDs)public java.lang.Object configure(java.lang.Object obj) throws java.lang.Exception
configure
in interface ConfigurationProcessor
java.lang.Exception
public java.lang.Object configure() throws java.lang.Exception
configure
in interface ConfigurationProcessor
java.lang.Exception
ConfigurationProcessor.configure()
private void doConfigure()