Page 1 of 2 12 LastLast
Results 1 to 10 of 17

Thread: Groovy bean factory?

  1. #1
    Join Date
    Aug 2004
    Posts
    109

    Default Groovy bean factory?

    I came accross this http://www.almaer.com/blog/archives/000356.html page. Yesterday I checked out a fresh version of spring and can not see the groovy stuff.

    Where can I find it?

    I have been using Pico for a while and scripting configuration of the container is a great feature in my opinion.
    Thanks,
    Alex.

  2. #2
    Join Date
    Aug 2004
    Location
    Toronto, Canada
    Posts
    736

    Default

    Looks like checking this code in got lost in the shuffle. In an email dated July 30th, Rod said he wanted to check the code into the sandbox, but just wanted to make sure no other developers objected to the fact that groovy.jar would then have to also be checked in.

    I've replied to that email to try to get the code into CVS....
    Colin Sampaleanu
    SpringSource - http://www.springsource.com

  3. #3

    Default

    Colin,

    The code you are refering to is already in CVS since a couple of weeks. It's in the sandbox though, it's not in the main folder yet..

  4. #4
    Join Date
    Aug 2004
    Posts
    109

    Default

    oh, I see ...
    I was not looking inside sandbox directory :o
    Thanks,
    Alex.

  5. #5
    Join Date
    Aug 2004
    Location
    Toronto, Canada
    Posts
    736

    Default

    You are right. I got confused since the package name changed since Dion's original post.
    Colin Sampaleanu
    SpringSource - http://www.springsource.com

  6. #6
    Join Date
    Aug 2004
    Location
    San Mateo, CA
    Posts
    1,265

    Default

    It's in the sandbox. Look at the sandbox tests for an example. IMO it's pretty cool--you can write any bean in Groovy, configuring it via DI. You can then edit the script and Spring will automatically reload it when it's changed, still honouring references held by any other objects configured by DI.

    If you decide for whatever reason that you want to rewrite your Groovy bean in Java, you can do so and just change the bean definition. Of course your Groovy bean should normally implement one or more interfaces.

    I've also verified that the same approach works for BeanShell, although I haven't checked that in. Most of the Groovy support is generic to any scripting language: bsh support was about 20 lines.

    I agree with Dion that it's a great idea (arguably an emerging best practice) to write web tier controllers in a scripting language. With a proper architecture, they do not contain core business logic.

    It will be released in 1.2.

    This allows Spring beans to be written in Groovy. We are also considering options to allow contexts to be created in Groovy, but there's no code for that yet.

    Rgds
    Rod

  7. #7
    Join Date
    Aug 2004
    Location
    Hawaii, US
    Posts
    225

    Default

    Hello,

    Any chance the BeanShell code would be checked into the sandbox? I'd love to take a look at that and start playing with it.

    Thank!
    Seth

  8. #8
    Join Date
    Aug 2004
    Location
    San Mateo, CA
    Posts
    1,265

    Default

    Seth

    I've checked in beanshell support. See the org.springframework.beans.factory.script.bsh package in the sandbox. Comments welcome. The beanshell tests are a bit basic at present--I really should pull out an abstract test suite to share between different scripting languages.

    Both inline scripts (prefixed with inline and resource locations are supported.

    I've also done some refactoring and a package move on the Groovy support. However it's still the same from a user perspective.

    Rgds
    Rod
    Rod Johnson - GM, SpringSource Division, VMware
    http://www.springsource.com
    Spring From the Source

  9. #9
    Join Date
    Aug 2004
    Location
    Hawaii, US
    Posts
    225

    Default

    Thanks Rod!

    We're starting a new initiative to reduce compilation and deployment time. Anything we can do to reduce starting and restarting Tomcat will be really helpful.

    I'm going to look at this today. Thanks again!
    Seth

  10. #10
    Join Date
    Aug 2004
    Location
    San Mateo, CA
    Posts
    1,265

    Default

    Seth

    I've just significantly enhanced BeanShell support to allow DI via properties on bsh scripts, and to allow bsh scripts to implement more than one interface. I do the first using CGLIB InterfaceMaker as suggested by Chris Nokleberg in another thread to create a config interface with all setters specified in the bean definition, and the second through a little trickery with Spring AOP introductions.

    I should have time to check this in tomorrow.

    Rgds
    Rod
    Rod Johnson - GM, SpringSource Division, VMware
    http://www.springsource.com
    Spring From the Source

Similar Threads

  1. Spring container fails with no exception
    By naor in forum Container
    Replies: 9
    Last Post: Oct 1st, 2005, 03:39 PM
  2. EHCaching Hibernate
    By dencamel in forum Data
    Replies: 3
    Last Post: Sep 6th, 2005, 09:03 PM
  3. Stack Overflow
    By rayho222 in forum Container
    Replies: 6
    Last Post: May 17th, 2005, 03:42 AM
  4. could not satisfy dependencies
    By springuser in forum Container
    Replies: 4
    Last Post: Apr 26th, 2005, 01:15 PM
  5. Replies: 1
    Last Post: Apr 25th, 2005, 07:37 PM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •