|
From: <jas...@ma...> - 2004-07-09 15:28:38
|
On 9 Jul 2004, at 15:59, Rod Johnson wrote: > I haven't had time to read this thread in detail (will later tonight), > but I > think we should allow for non-XML Spring configs. Now we have sep > BeanDefinitionReaders, some beans could be sourced via JDBC, Groovy, > properties, or other cool definition formats as yet unknown... Agreed - alternatives to XML could be handy and could be used by any user of spring, whether they intend to deploy in Geronimo or not. e.g. in Groovy we could change something like this... <?xml version="1.0" encoding="UTF-8"?> <!DOCTYPE beans PUBLIC "-//SPRING//DTD BEAN//EN" "http://www.springframework.org/dtd/spring-beans.dtd"> <beans> <bean id="myDataSource" class="org.apache.commons.dbcp.BasicDataSource" destroy-method="close"> <property name="driverClassName"><value>com.mysql.jdbc.Driver</value></property> <property name="url"><value>jdbc:mysql://localhost:3306/mydb</value></property> <property name="username"><value>root</value></property> </bean> </beans> into this Foo.groovy file bean(id:"myDataSource", class:org.apache.commons.dbcp.BasicDataSource.class, destroy_method:"close", driverClassName:"com.mysql.jdbc.Driver", url:"jdbc:mysql://localhost:3306/mydb", username:"root") Which saves a bit of typing, avoids the pointy bracket stuff and allows variables and expressions to be used (e.g. so the same script can be reused but at runtime use different parameterizable port numbers etc). Of course if ever you want if / while / for loops in your configuration, then the scripting language approach becomes a huge win. James ------- http://radio.weblogs.com/0112098/ |