What is the lifecycle of a Controller in Spring MVC?
When is the controller created, when destroyed? Is it shared among multiple threads? Can it be in use simultaneously by more than one request.
See Question&Answers more detail:osWhat is the lifecycle of a Controller in Spring MVC?
When is the controller created, when destroyed? Is it shared among multiple threads? Can it be in use simultaneously by more than one request.
See Question&Answers more detail:osHere's a view of the lifecycle:
http://www.flickr.com/photos/60896767@N00/89101625/sizes/l/
Yes, they're shared by threads/requests; you should write them to be thread-safe. They should be stateless. Usually they have a reference to a Spring service that does all the work. Controllers handle binding, validation, and routing for the web tier.