Feb 26 2010

Spring 3.0 REST Release Update

Published by at 8:58 am under Java,REST,Spring

In December 2009 I talked about getting a RESTful web service up and running using Spring 3.0.0.RC3. Since then Spring has had 3.0.0.RELEASE and 3.0.1.RELEASE. One of these releases caused my code example from this post to fail, so I’ve re-worked it and tested with Spring 3.0.1.RELEASE.

You can get the new code here.

The changes were fairly simple. First, I changed the spring.version property in the POM to 3.0.0.RELEASE. Next, I added a dependency to Apache Commons Logging.

...
<dependency>
   <groupId>commons-logging</groupId>
   <artifactId>commons-logging</artifactId>
   <version>1.1.1</version>
</dependency>
...

It appears that Spring 3 RELEASE now has a runtime dependency on commons-logging, so this was necessary to deploy the application to Tomcat.

Look for upcoming posts on doing content negotiation using Spring 3.0.

Problems?

If you are having trouble getting the code to import or compile try one or both of the following:

  1. Go to Window->Preferences->Maven->Installations and choose your local Maven installation rather than the embedded Maven. I find that this reduces a some of the strange errors I used to get.
  2. Import spring-rest-example-model first and do a mvn install before importing spring-rest-example. I’ve noticed that Eclipse or STS will often throw a NullpointerException if I don’t follow these steps and attempt to import both projects at the same time.

2 responses so far

2 Responses to “Spring 3.0 REST Release Update”

  1. Jerryon 19 Mar 2010 at 9:07 am

    Hi, have you tried installing this under eclipse?
    As an old ant guy, i find it difficult to build with eclipse. Hints?

  2. Tonyon 19 Mar 2010 at 10:13 am

    Eclipse with the m2eclipse plugin (Maven plugin) will enable it to build. Or, if you want to do it the easy way just install Spring’s version of Eclipse that has the m2eclipse plugin and Spring plugins already installed. They call it the Springsource Tool Suite
    http://www.springsource.com/products/eclipse-downloads