Alternative to Java/Spring based Webservices
I'm looking for alternatives for my team to create simple REST services which respond in JSON format to several clients. As far these services are developed on Spring MVC with Hibernate. It is a mandatory to connect and work with legacy databases (SQLServer, DB2 and MySQL - depends on project). Now I'm looking for alternatives to take the service development to a lighter approach. Don't get me wrong: Spring does a good job but sadly not everyone in our team is familiar with Spring even Hibernate. Addtion to this: In most cases not the full Spring stack is even needed. It would help also to get rid of the JVM too.
I was thinking of something script-like solution. Maybe PHP? Is there something like an ORM which could work on legacy DB systems? Same for Ruby on Rails.
Maybe there is something which I haven't heard of or come to now. I would love to hear you opinions or experiences whith other techniques.
Regards
JAX-RS is a really nice lightweight way of doing rest on the JVM. There are plugins that convert JAXB annotated objects into JSON, or you could just roll that yourself in a multitude of ways.
EclipseLink is a good implementation of the JPA spec. Its a pretty easy way to map your objects to the database through annotations. JAX-RS works with this by default, eg you can look up an object with JPA. You can then annotate it with JAXB and then return it straight up from your web service method (if you want XML) and it will just work. There's also a plugin for Jersey (the JAX-RS reference implementation) that allows you to serialize things as JSON this way too.
These JAX-RS, JPA and JAXB are three really nice API's. They don't do everything, but they're lightweight and help you to get real work done without a lot of fuss.
Not sure if you would be willing to go in this direction, but I recently wrote a webservice in ASP.NET MVC 3. You can bind the passed JSON directly to object models without having to write any extra code. You can also configure the URLs to match the REST standard. If you are working with something like SQL Server this approach would probably be pretty straightforward.
I'd recommend Rails or Sinatra (which you could run on top of Java with JRuby). Both can take advantage of ActiveRecord and other Ruby ORM and DB connection libraries; you should be able to make these libraries talk to your legacy databases without too much trouble.
链接地址: http://www.djcxy.com/p/10154.html