What will happen if I use static methods (say from a utility class that I created) with Spring MVC. Moreover, my static methods are not synchronized. What may happen if multiple requests call the same method at same time.
Its OK to use static methods if you know what you're doing. If in your static method you're using only local variables ( not fields in a class ) you should then be thread-safe too. Otherwise - it is up to you do handle the synchronization and locking to keep data consistent.
Spring has a limitation that you cannot use static
on setters of spring beans.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With