In Maven 3 there are new DSL replacements for the POMs. See: http://polyglot.sonatype.org/groovy.html for the wonderfully terse syntax.
Is there something similar that can be used for Spring applicationcontext.xml files?
In Maven 3 there are new DSL replacements for the POMs. See: http://polyglot.sonatype.org/groovy.html for the wonderfully terse syntax.
Is there something similar that can be used for Spring applicationcontext.xml files?
In Spring 3 you may use Java-based container configuration, see 3.11 Java-based container configuration. It also plays well with autodetection of components. To use these features instead of applicationContext.xml
, add the following to web.xml
:
<context-param>
<param-name>contextClass</param-name>
<param-value>org.springframework.web.context.support.AnnotationConfigWebApplicationContext</param-value>
</context-param>
<context-param>
<param-name>contextConfigLocation</param-name>
<param-value>
... package and class names to use for configuration ...
</param-value>
</context-param>
You may also configure DispatcherServlet
in the same way - with <init-param>
instead of <context-param>
.
Have a look at the Grails Spring BeanBuilder, that provides a "groovy" way for the definition and configuration of Spring beans: http://www.grails.org/Spring+Bean+Builder