spring MVC框架Controller層中應(yīng)該使用StringBuffer還是StringBuilder?
光陰似箭催人老,日月如移越少年。
If you use it as a global variable, you can only use StringBuffer, because spring mvc is not thread-safe. If it is only used as a local variable, use stringBuilder. The functions of the two of them are exactly the same, but the methods of StringBuffer are all synchronized methods, which improves performance under multi-threading. Worse than StringBuilder.
There is no thread safety issue when written in a method. . . Stringbuilder speed comparison, it is recommended to use it when operating large amounts of data