I've been spending a lot of time at Hackerrank lately, also getting up to speed on Java 8, but I suddenly realized I hadn't done much with Spring for a while.
So, this is maybe about an 8 hour effort over the course of 2 weeks or so. It's a RESTful web service for Pokemons.
Writing a RESTful web service in Spring these days is not quite as easy as in Grails, but it's really pretty easy. I just used MVC and @RestController.
For integration testing I followed the example in Building REST services with Spring. I had glanced at the documentation for Spring MVC Test Framework before but never really used it, so this part was mostly new to me. It lets you test MVC requests without bringing up a full Servlet container.
I'm aware of Spring Data Rest. Here's a pretty good presentation: Advanced Spring Data REST - Oliver Gierke. I'm getting ready to give this a try but wanted to go through the exercise of doing the REST implementation 'by hand' first.
Subscribe to:
Post Comments (Atom)
No comments:
Post a Comment