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:
- 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.
- Import
spring-rest-example-model
first and do amvn install
before importingspring-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.