mvc

Spring MVC: how to build a thread-safe Controller

Controllers in Spring MVC are designed to be shared between requests. Each controller has a default singleton scope so if you are using controllers you need to be aware of that. The easiest way to make sure your controller is thread-safe is to avoid class variables. F.ex. this example from Spring MVC tutorial: