Making your Spring configuration more "Springy" - No Fluff Just Stuff

Making your Spring configuration more "Springy"

Posted by: Craig Walls on March 31, 2007

In case you missed it (I almost did), Springy 0.2 was released a little over a week ago.

Springy is yet another way to configure Spring without XML. This time, the configuration is done with JRuby. I wanted to cook up an example to show it off, but the following code from Springy's own examples is far cooler than anything I could think of:

DAOS = [ :ZoneDAO, :EmailDomainDAO, :DayDAO, :PreferenceDAO,
                 :WhatEverDao... ]
DAOS.each do |dao|
    bean(dao, "daos.hibernate.#{dao}Hibernate")
      {|b| b.new("sonarSession")}
end

What this code does, in case you're wondering, is use Ruby metaprogramming to create several DAO beans all in just a few lines of code.

One of the interesting new features in 0.2 is a "serialize to XML" feature which transforms the Springy JRuby configuration into good old fashioned Spring XML configuration.

It's still pre-1.0, but this 0.2 release of Springy shows tons of promise and is another very interesting alternative to Spring's XML. Definitely something to look into.

Craig Walls

About Craig Walls

Craig Walls is a Principal Engineer, Java Champion, Alexa Champion, and the author of Spring AI in Action, Spring in Action, and Build Talking Apps. He's a zealous promoter of the Spring Framework, speaking frequently at local user groups and conferences and writing about Spring. When he's not slinging code, Craig is planning his next trip to Disney World or Disneyland and spending as much time as he can with his wife, two daughters, 1 bird and 2 dogs.

Why Attend the NFJS Tour?

  • » Cutting-Edge Technologies
  • » Agile Practices
  • » Peer Exchange

Current Topics:

  • Languages on the JVM: Scala, Groovy, Clojure
  • Enterprise Java
  • Core Java, Java 8
  • Agility
  • Testing: Geb, Spock, Easyb
  • REST
  • NoSQL: MongoDB, Cassandra
  • Hadoop
  • Spring 4
  • Cloud
  • Automation Tools: Gradle, Git, Jenkins, Sonar
  • HTML5, CSS3, AngularJS, jQuery, Usability
  • Mobile Apps - iPhone and Android
  • More...
Learn More »