class ScriptBeanDefinitionParser extends AbstractBeanDefinitionParser
<lang:groovy/>
',
'<lang:std/>
' and '<lang:bsh/>
' tags.
Allows for objects written using dynamic languages to be easily exposed with
the BeanFactory
.
The script for each object can be specified either as a reference to the
resource containing it (using the 'script-source
' attribute) or inline
in the XML configuration itself (using the 'inline-script
' attribute.
By default, dynamic objects created with these tags are not
refreshable. To enable refreshing, specify the refresh check delay for each
object (in milliseconds) using the 'refresh-check-delay
' attribute.
Modifier and Type | Field and Description |
---|---|
private static java.lang.String |
AUTOWIRE_ATTRIBUTE |
private static java.lang.String |
CUSTOMIZER_REF_ATTRIBUTE |
private static java.lang.String |
DEPENDENCY_CHECK_ATTRIBUTE |
private static java.lang.String |
DEPENDS_ON_ATTRIBUTE |
private static java.lang.String |
DESTROY_METHOD_ATTRIBUTE |
private static java.lang.String |
ENGINE_ATTRIBUTE |
private static java.lang.String |
INIT_METHOD_ATTRIBUTE |
private static java.lang.String |
INLINE_SCRIPT_ELEMENT |
private static java.lang.String |
PROXY_TARGET_CLASS_ATTRIBUTE |
private static java.lang.String |
REFRESH_CHECK_DELAY_ATTRIBUTE |
private static java.lang.String |
SCOPE_ATTRIBUTE |
private static java.lang.String |
SCRIPT_INTERFACES_ATTRIBUTE |
private static java.lang.String |
SCRIPT_SOURCE_ATTRIBUTE |
private java.lang.String |
scriptFactoryClassName
The
ScriptFactory class that this
parser instance will create bean definitions for. |
ID_ATTRIBUTE, NAME_ATTRIBUTE
Constructor and Description |
---|
ScriptBeanDefinitionParser(java.lang.String scriptFactoryClassName)
Create a new instance of this parser, creating bean definitions for the
supplied
ScriptFactory class. |
Modifier and Type | Method and Description |
---|---|
protected AbstractBeanDefinition |
parseInternal(org.w3c.dom.Element element,
ParserContext parserContext)
Parses the dynamic object element and returns the resulting bean definition.
|
private java.lang.String |
resolveScriptSource(org.w3c.dom.Element element,
XmlReaderContext readerContext)
Resolves the script source from either the '
script-source ' attribute or
the 'inline-script ' element. |
protected boolean |
shouldGenerateIdAsFallback()
Scripted beans may be anonymous as well.
|
parse, postProcessComponentDefinition, registerBeanDefinition, resolveId, shouldFireEvents, shouldGenerateId, shouldParseNameAsAliases
private static final java.lang.String ENGINE_ATTRIBUTE
private static final java.lang.String SCRIPT_SOURCE_ATTRIBUTE
private static final java.lang.String INLINE_SCRIPT_ELEMENT
private static final java.lang.String SCOPE_ATTRIBUTE
private static final java.lang.String AUTOWIRE_ATTRIBUTE
private static final java.lang.String DEPENDENCY_CHECK_ATTRIBUTE
private static final java.lang.String DEPENDS_ON_ATTRIBUTE
private static final java.lang.String INIT_METHOD_ATTRIBUTE
private static final java.lang.String DESTROY_METHOD_ATTRIBUTE
private static final java.lang.String SCRIPT_INTERFACES_ATTRIBUTE
private static final java.lang.String REFRESH_CHECK_DELAY_ATTRIBUTE
private static final java.lang.String PROXY_TARGET_CLASS_ATTRIBUTE
private static final java.lang.String CUSTOMIZER_REF_ATTRIBUTE
private final java.lang.String scriptFactoryClassName
ScriptFactory
class that this
parser instance will create bean definitions for.public ScriptBeanDefinitionParser(java.lang.String scriptFactoryClassName)
ScriptFactory
class.scriptFactoryClassName
- the ScriptFactory class to operate onprotected AbstractBeanDefinition parseInternal(org.w3c.dom.Element element, ParserContext parserContext)
ScriptFactoryPostProcessor
if needed.parseInternal
in class AbstractBeanDefinitionParser
element
- the element that is to be parsed into one or more BeanDefinitions
parserContext
- the object encapsulating the current state of the parsing process;
provides access to a BeanDefinitionRegistry
BeanDefinition
resulting from the parsing of the supplied Element
AbstractBeanDefinitionParser.parse(org.w3c.dom.Element, ParserContext)
,
AbstractBeanDefinitionParser.postProcessComponentDefinition(org.springframework.beans.factory.parsing.BeanComponentDefinition)
private java.lang.String resolveScriptSource(org.w3c.dom.Element element, XmlReaderContext readerContext)
script-source
' attribute or
the 'inline-script
' element. Logs and ReaderContext.error(java.lang.String, java.lang.Object)
and
returns null
if neither or both of these values are specified.protected boolean shouldGenerateIdAsFallback()
shouldGenerateIdAsFallback
in class AbstractBeanDefinitionParser