I got the following to work:
which should have the same functionality as Crazy Bob's email to the spring-dev email groupCode: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) .setLazyInit(true) .constructor("test") // "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") ]) } }
This is all scripted in Groovy and accessible either vi programmatic means or via the following xml:
The ProgrammableConfigurer is a wrapper around a GenericApplicationContext such as a StaticApplicationContext which has similar functionality as a BeanDefinitionRegistryBuilder.HTML Code:<?xml version="1.0" encoding="UTF-8"?> <beans xmlns="http://www.springframework.org/schema/beans" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:lang-config="http://www.agiledevelopments.com/schema/lang_config" xsi:schemaLocation=" http://www.agiledevelopments.com/schema/lang_config http://www.agiledevelopments.com/schema/lang_config/lang_config.xsd http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans.xsd "> <lang-config:groovy-config script-source="/bean_config1.groovy" /> </beans>
I wanted to get your thoughts on this implementation...


Reply With Quote