Spring+Hibernate: How to convert entities to XML/JSON?

Spring makes it remarkably easy to write controllers which return XML or JSON response. Simply add the annotation @ResponseBody to your controller definition and you are done. Whatever you will return from your controller method will be automatically converted to XML or JSON (depending upon “Accept” header of the request). The return type of the controller can be any Object: ranging from maps and beans to collections and arrays.
Continue reading Spring+Hibernate: How to convert entities to XML/JSON?