Consistent support for CompilationCustomizers as well as custom CompilerConfiguration

Issue: SPR-14585
(cherry picked from commit 6a0d9d3)
This commit is contained in:
Juergen Hoeller
2016-08-17 11:29:49 +02:00
parent d057099c17
commit fbeff475b3
8 changed files with 212 additions and 24 deletions

View File

@@ -7764,7 +7764,6 @@ set some default property values, or specify a custom `MetaClass`.
public interface GroovyObjectCustomizer {
void customize(GroovyObject goo);
}
----
@@ -7803,12 +7802,12 @@ of a `GroovyObjectCustomizer` is easy if you are using the Spring namespace supp
[subs="verbatim,quotes"]
----
<!-- define the GroovyObjectCustomizer just like any other bean -->
<bean id="tracingCustomizer" class="example.SimpleMethodTracingCustomizer" />
<bean id="tracingCustomizer" class="example.SimpleMethodTracingCustomizer"/>
<!-- ... and plug it into the desired Groovy bean via the 'customizer-ref' attribute -->
<lang:groovy id="calculator"
script-source="classpath:org/springframework/scripting/groovy/Calculator.groovy"
customizer-ref="tracingCustomizer" />
customizer-ref="tracingCustomizer"/>
----
If you are not using the Spring namespace support, you can still use the
@@ -7821,13 +7820,19 @@ If you are not using the Spring namespace support, you can still use the
<constructor-arg value="classpath:org/springframework/scripting/groovy/Calculator.groovy"/>
<!-- define the GroovyObjectCustomizer (as an inner bean) -->
<constructor-arg>
<bean id="tracingCustomizer" class="example.SimpleMethodTracingCustomizer" />
<bean id="tracingCustomizer" class="example.SimpleMethodTracingCustomizer"/>
</constructor-arg>
</bean>
<bean class="org.springframework.scripting.support.ScriptFactoryPostProcessor"/>
----
[NOTE]
====
As of Spring Framework 4.3.3, you may also specify a Groovy `CompilationCustomizer` type
such as an `ImportCustomizer` in the same place as Spring's `GroovyObjectCustomizer`.
====
[[dynamic-language-beans-bsh]]