Can I create RESTFUL Web services in Spring 3.0 without MVC
Currently building a "Business Layer", that serves up JSON to a PHP application. Considering using Spring with growth of the application in mind.
All my research so far leads me to believe that restful web services are only possible in an MVC context. Since my 开发者_JAVA技巧front end (display tier) is not Java MVC does not make sense.
Am I missing anything or this a limitation of Spring WS ? If thats the case then what are the other possible alternatives ? Jersey/Restlet for JAX-RS ?
There's no reason you can't use Spring MVC for your REST services. It would work just as well as JAX-RS.
As long as you use mvc:annotation-driven and Jackson is on the classpath then all you should need to do is use @ResponseBody
on your controller methods and the return type will be converted to JSON per Spring's standard HTTP Message Conversion functionality.
Also check out this video at around 37:00: Mastering Spring MVC.
精彩评论