This is similar to the
FactoryBean mechanism, but is
specifically tailored for scripts and not built into Spring's core
container itself but rather implemented as an extension.

NOTE: The most important characteristic of this post-processor
is that constructor arguments are applied to the
ScriptFactory instance
while bean property values are applied to the generated scripted object.
Typically, constructor arguments include a script source locator and
potentially script interfaces, while bean property values include
references and config values to inject into the scripted object itself.

The following ScriptFactoryPostProcessor will automatically
be applied to the two
ScriptFactory definitions below.
At runtime, the actual scripted objects will be exposed for
"bshMessenger" and "groovyMessenger", rather than the
ScriptFactory instances. Both of
those are supposed to be castable to the example's Messenger
interfaces here.

NOTE: Please note that the above excerpt from a Spring
XML bean definition file uses just the <bean/>-style syntax
(in an effort to illustrate using the ScriptFactoryPostProcessor itself).
In reality, you would never create a <bean/> definition for a
ScriptFactoryPostProcessor explicitly; rather you would import the
tags from the 'lang' namespace and simply create scripted
beans using the tags in that namespace... as part of doing so, a
ScriptFactoryPostProcessor will implicitly be created for you.

The Spring reference documentation contains numerous examples of using
tags in the 'lang' namespace; by way of an example, find below
a Groovy-backed bean defined using the 'lang:groovy' tag.

Create a bean definition for the scripted object, based on the given script
definition, extracting the definition data that is relevant for the scripted
object (that is, everything but bean class and constructor arguments).

Create a ScriptFactory bean definition based on the given script definition,
extracting only the definition data that is relevant for the ScriptFactory
(that is, only bean class and constructor arguments).

setResourceLoader

This might be a ResourcePatternResolver, which can be checked
through instanceof ResourcePatternResolver. See also the
ResourcePatternUtils.getResourcePatternResolver method.

Invoked after population of normal bean properties but before an init callback
like InitializingBean's afterPropertiesSet or a custom init-method.
Invoked before ApplicationContextAware's setApplicationContext.

postProcessBeforeInstantiation

Apply this BeanPostProcessor before the target bean gets instantiated.
The returned bean object may be a proxy to use instead of the target bean,
effectively suppressing default instantiation of the target bean.

resolveProxyTargetClass

createScriptFactoryBeanDefinition

Create a ScriptFactory bean definition based on the given script definition,
extracting only the definition data that is relevant for the ScriptFactory
(that is, only bean class and constructor arguments).

createScriptedObjectBeanDefinition

Create a bean definition for the scripted object, based on the given script
definition, extracting the definition data that is relevant for the scripted
object (that is, everything but bean class and constructor arguments).

Parameters:

bd - the full script bean definition

scriptFactoryBeanName - the name of the internal ScriptFactory bean

scriptSource - the ScriptSource for the scripted bean

interfaces - the interfaces that the scripted bean is supposed to implement