SpringMVC 控制器默认是单例模式,通过@Scope(value = ConfigurableBeanFactory.SCOPE_PROTOTYPE)可成为多例模式,或者写成@Scope("prototype")。
单例模式下定义成员变量是线程不安全的。
使用单例模式是为了性能(无需频繁初始化),同时也没有必要使用多例模式。
https://www.cnblogs.com/areyouready/p/7780810.html