I have a question about thread safety. From what I have been told, SimpleDateFormat is not thread safe. I was wondering what effects it would have if I use it the followin
So what kind of problems will I see using it this way?
Developers of SimpleDateFormat
took a very strange decision - during work of parse()
they store partially parsed date in a field of SimpleDateFormat
. Obviously, it means that you can't call parse()
from several threads simultaneously.
Would simply removing the static keyword fix any issues because then each thread will use its own instance of dateFormat?
Removing static
won't help you, since Spring controllers are singleton scoped by default, so Spring uses a single instance of your controller to serve all requests.