Spring MVC thread safe distilled

I come across this question when a controller in Spring MVC which scope is Singleton, is it thread safe?

The answer is NO.

According to java concurrency thread safety is that the shared data, like instance variables and can be modified, then the Singleton Spring MVC controller has the instance variables, or injected autowired Spring bean isn't 100% thread safe. But when member variables, inside the method body, then they are thread safe and no need for synchronised.

Now come along some goodies of the best practice of playing thread safety in Spring by following these simple rules:

1. Don’t use states on Controllers, Service Layer Objects and DAOs
2. If you can’t avoid, first rethink your design, unless you have to use synchronized
3. If you want to use prototype scoped beans, be aware of instance explosion