Build Your Own Spring Config DSL

Last week I posted a teaser for a Ruby-based DSL for Spring configuration. Like so many things, I doubt I will ever have time to carry this through so I am posting the code here. Please run with this if you are interested.

Here's the approach I used:

  • Create RubyBeanFactory as a subclass of XmlBeanFactory.
  • Execute the loaded resource, and treat the result as XML. I used Ruby but you could easily plug in some other language.
  • Create a helper (spring_config.rb) that defines a simple DSL instead of writing straight Ruby code.
  • .

If you plan to use this in production you will want to:

  • Refactor hard-coded stuff
  • Extend the DSL to handle more than just a subset of the Spring config vocabulary

Get In Touch