Create groovy bean instance from Spring context XML?

classic Classic list List threaded Threaded
3 messages Options
Reply | Threaded
Open this post in threaded view
|

Create groovy bean instance from Spring context XML?

Marc Palmer Local

Hi,

Has anybody got a Java wrapper class that can be used as a factory  
for Groovy beans that have not been compiled yet?

i.e, in Spring config something like:

  <bean name="myGroovyBean" class="some.factory.class"
     <property name="script"><value>myScriptBean.groovy</value></
property>
  </bean>

...and Spring would therefore be able to create instances of Groovy  
beans that have not been compiled yet. Problems with accessing shared  
GroovyClassLoader(s) I think.

~ ~ ~
Marc Palmer ([hidden email])
Consultant/Analyst
AnyWare Ltd.
http://www.anyware.co.uk/

Reply | Threaded
Open this post in threaded view
|

Re: Create groovy bean instance from Spring context XML?

graemer
There is one already in spring class that does this. See
http://www.almaer.com/blog/archives/000356.html

Graeme

On 12/12/05, Marc Palmer <[hidden email]> wrote:

>
> Hi,
>
> Has anybody got a Java wrapper class that can be used as a factory
> for Groovy beans that have not been compiled yet?
>
> i.e, in Spring config something like:
>
>   <bean name="myGroovyBean" class="some.factory.class"
>      <property name="script"><value>myScriptBean.groovy</value></
> property>
>   </bean>
>
> ...and Spring would therefore be able to create instances of Groovy
> beans that have not been compiled yet. Problems with accessing shared
> GroovyClassLoader(s) I think.
>
> ~ ~ ~
> Marc Palmer ([hidden email])
> Consultant/Analyst
> AnyWare Ltd.
> http://www.anyware.co.uk/
>
>
Reply | Threaded
Open this post in threaded view
|

Re: Create groovy bean instance from Spring context XML?

Alex Shneyderman
In reply to this post by Marc Palmer Local
Actually there is support for it in Spring's sandbox.

Spring guys developed factory bean that produces beans based on your
groovy script. you can either inline it or have anoutside script that
will be read and compiled (also autoreferesh will be supported)

HTH,
Alex.

On 12/12/05, Marc Palmer <[hidden email]> wrote:

>
> Hi,
>
> Has anybody got a Java wrapper class that can be used as a factory
> for Groovy beans that have not been compiled yet?
>
> i.e, in Spring config something like:
>
>   <bean name="myGroovyBean" class="some.factory.class"
>      <property name="script"><value>myScriptBean.groovy</value></
> property>
>   </bean>
>
> ...and Spring would therefore be able to create instances of Groovy
> beans that have not been compiled yet. Problems with accessing shared
> GroovyClassLoader(s) I think.
>
> ~ ~ ~
> Marc Palmer ([hidden email])
> Consultant/Analyst
> AnyWare Ltd.
> http://www.anyware.co.uk/
>
>