1

I want to know that why we use jersey with spring and what are the benefits of using it. I have searched on google but not getting proper answer so i am asking this question here.Sorry because i know my question is old but i am very confused now.

Please suggest me the example of jersey with spring and hibernate.

Thanx in advance.

Nadeem Ahmed
  • 371
  • 2
  • 8
  • 24

1 Answers1

0

I use Jersey2 with Spring in one of my projects and in the other Spring MVC4. The advantage of Jersey is its simplicity. If you are creating only RESTful Web services - use Jersey, if you have to generate also some web pages for users, consider to use Spring MVC.

Additionally, I develop my applications on Google Cloud, so the warm up time is very important (if there is a traffic spike, many instances have to wake up in the background to be ready for incoming requests) - according to my tests Jersey is a bit faster than MVC.

Here you have an example of complete configuration: Integrating Jersey 2 and Spring with Java Based Configuration

Community
  • 1
  • 1
Marek Raki
  • 3,056
  • 3
  • 27
  • 50
  • Thank you very much for your response... Actually i want to return only json object and want to use the url in my frontend...so according to you which is best for me..spring mvc or jersey with spring..Please suggest me – Nadeem Ahmed Aug 05 '15 at 11:43
  • depends on your project requirements, Jersey is very simple and easy to configure. If you choose this one you will start very fast. In Spring MVC you have to spend a bit more time with configuration. You will have many features but probably you wont use most of them. Anyway, it is just one layer, you can change it later if you reach the limitations. We initially had MVC and we moved to Jersey. It is not so painful. – Marek Raki Aug 05 '15 at 11:57
  • But why we use jersey with spring mvc? – Nadeem Ahmed Aug 06 '15 at 05:01