Announcement Announcement Module
No announcement yet.
Groovy Config for Spring 2.0 Page Title Module
Move Remove Collapse
Conversation Detail Module
  • Filter
  • Time
  • Show
Clear All
new posts

  • Groovy Config for Spring 2.0

    I got the following to work:

    package blog.solomon.crazybob;
    import blog.solomon.spring.config.ProgrammableConfigurer;
    class MyConfigrurer extends ProgrammableConfigurer {
        void configure() {
            // "tee" definition... notice that TeeImpl is not fully qualified ;)
            bean("tee", TeeImpl.class)
            // "bar" definition... I used varargs in the constructor 
            // instead of multiple calls to constructor.generic()
            prototype("bar", BarImpl.class)
                .constructor( 5, ref("tee") )
            // "foo" definition... Use the a Groovy created map to define the properties.
            prototype("foo", Foo.class).properties([
                "i": "5",            
                "s": "test", 
                "bar": ref("bar"),   
                "copy": ref("bar")
    which should have the same functionality as Crazy Bob's email to the spring-dev email group

    This is all scripted in Groovy and accessible either vi programmatic means or via the following xml:

    HTML Code:
    <?xml version="1.0" encoding="UTF-8"?>
    <beans xmlns="" xmlns:xsi=""
        <lang-config:groovy-config script-source="/bean_config1.groovy" />
    The ProgrammableConfigurer is a wrapper around a GenericApplicationContext such as a StaticApplicationContext which has similar functionality as a BeanDefinitionRegistryBuilder.

    I wanted to get your thoughts on this implementation...