Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Comparison JAX-RS and Spring Rest Services

I am developing a secure web application that does financial transactions and using spring in it. Which will be more suitable to use for security, JAX-RS services or spring rest services? I thought of going with spring as we are already using it in application and if it provides the features then why to go for JAX-RS, but as I said its a highly secured web application where people will buy things and make financial transactions so I have to see which is more suitable to use.

I followed the following blogs still a little confused…

  • http://sleeplessinslc.blogspot.in/2012/02/jersey-jax-rs-mvc-killed-spring-mvc.html
  • http://blog.cyclopsgroup.org/2012/10/jaxrs-client-on-android.html
  • http://www.infoq.com/articles/springmvc_jsx-rs

Can anybody suggest which will be more useful to use ??

like image 884
Ruby Avatar asked Mar 03 '13 07:03

Ruby


1 Answers

It's not an either-or choice. I use Spring and JAX-RS (specifically, Apache CXF, which implements the JAX-RS specification) together in the same secured application.

The key to understanding this is to note that Spring isn't one homogenous lump. It's actually many pieces. The parts I'm using are (approximately) the Spring IoC core, Spring AOP and Spring Security. The IoC core is the part that is Spring; it manages the lifecycle and configuration of your beans. I use AOP for transaction management (since that's far easier than coding all that myself in each method that needs a transaction). The management of the dispatch of the REST calls to my code is handled by Apache CXF (which sits very nicely inside Spring IoC provided you use the right context loader) and that does work well with Spring Security.


As a side note, you are aware that financial transaction handling is tricky? Not because the code is that much harder, but because the consequences of getting it wrong are worse and there are plenty of people willing to try to make things go wrong for personal gain.

like image 151
Donal Fellows Avatar answered Oct 14 '22 03:10

Donal Fellows