3

I have create Restful web service using Spring MVC.

As theory says Restful request is stateless, mean no session is required.

But what I have observed with Spring MVC is that for each Restful request it creates session.

My question is :- Why Spring MVC creates session for each restful request ? Is it possible to stop creation of session ?

Dhaval Patel
  • 608
  • 7
  • 15
  • possible duplicate of [How is Spring MVC a REST Framework?](http://stackoverflow.com/questions/15916339/how-is-spring-mvc-a-rest-framework) – flup May 20 '13 at 16:40
  • Check out the answer here: http://stackoverflow.com/questions/11946903/how-can-i-disable-spring-form-based-login-for-restful-endpoints. If your RESTful API is on its own URL path, you can set up a filter to say that it is stateless. – Erik Nedwidek May 20 '13 at 16:42
  • Are you using spring security as well? I feel that Spring-MVc doesn't create session automatically if you don't use any session bean. But spring security, unless specified, does. – Filippo De Luca May 21 '13 at 09:38
  • Yes, I am using Spring Security, you are right, spring security is creating session automatically. Is there any optimization solution or it is absolutely Ok to let Spring Security keep on creating session for each Rest request – Dhaval Patel Jan 12 '16 at 04:59

0 Answers0