Comparison JAX-RS and Spring Rest Services Comparison JAX-RS and Spring Rest Services spring spring

Comparison JAX-RS and Spring Rest Services


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.


I worked with both Jersey Rest and spring rest also Jersey Rest with spring also ,Both of then are Very rich frameworks with nice implementation ,I would suggest its better to go with Spring rest if you are using other Spring services such as ORM ,Spring security an DI etc , Both are spring libraries so i feel little bit essay for managing code and dependencies