BT

Facilitating the Spread of Knowledge and Innovation in Professional Software Development

Write for InfoQ

Topics

Choose your language

InfoQ Homepage News Springy Brings JRuby Power to Spring Configuration

Springy Brings JRuby Power to Spring Configuration

Last week's coverage of RSpec on Ruby (more coverage is available here) included the thought that JRuby was poised to start making waves by providing new, Ruby influenced tools to Java developers.  Springy looks like just the kind of tool Michael Studman was thinking of when he wrote:

I hope that ... more Java developers to sit up and notice Ruby as a language with incredible potential for all manner of problems.

 Springy is a simple DSL, written in JRuby, that lets Java developers wire up their Spring contexts without having to do "XML sit-ups".  For example:

<bean id="bean3" class="springy.beans.Bean3">
<constructor-arg value="${vic}"/>
<constructor-arg ref="bean2"/>
<property name="aProperty">
<list>
<ref bean="bean1"/>
<value>A String</value>
</list>
</property>
</bean>
becomes:
bean :bean3, "springy.beans.Bean3" do |b|  
  b.new(vic, :bean2).aProperty = [ :bean1, "A String" ]
end
(Contrived example taken from Jan Berkel's blog post about Springy.)

 


When asked about his use of JRuby, Jan said:
 We [Trampoline Systems] use a hybrid development strategy, using (C)Ruby on Rails for the frontend and Java for all backend related things (actually with bits of Lisp in it as well). It's really a "best-tool-for-the-job" approach.   Ruby/Rails is agile and productive whereas Java is the big guy in the background who does the heavy lifting.
And Springy's not the only way they're using JRuby:
Our build system is based on Rake with some Java-related extensions (which we've opensourced recently — Jerbil). It reduced the complexity of our build system from ca. 1500 lines of XML to 180 lines of Ruby, largely thanks to Ruby's metaprogramming capabilities.

 

While Springy isn't in wide use yet (it's only been publicly available for about 2 weeks), it certainly shows promise.  It also shows how well JRuby can leverage rubyisms for Java developers.  Jan talked about this too:
JRuby makes it very easy to extend existing Java code: it is getting to a point now where the boundaries between languages almost completely disappear, at least from a Ruby perspective. You can use and extend Java classes in a very natural way whilst retaining Ruby's power and flexibility.

 

The question doesn't seem to be "Will JRuby have an impact on Java developers?", it's "Where in Java world will JRuby's impact be felt most strongly?".  The first several 'cross-overs' have already occured.  Where will JRuby show up next.

Rate this Article

Adoption
Style

BT