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
RubyBeanFactoryas a subclass ofXmlBeanFactory. - 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. .
- Refactor hard-coded stuff
- Extend the DSL to handle more than just a subset of the Spring config vocabulary
Comments