一般情况下,只有[color=red]无状态的Bean才可以在多线程环境下共享[/color],在Spring中,绝大部分Bean都可以声明为singleton作用域。就是因为Spring对一些Bean(如RequestContextHolder、TransactionSynchronizationManager、LocaleContextHolder等)中非线程安全状态采用[color=red]ThreadLocal[/color]进行处理,让它们也成为线程安全的状态,因为[color=red]有状态的Bean就可以在多线程中共享[/color]了 ([color=darkblue]注意,这里说的共享,是共享bean,不是共享bean里面的变量[/color])
[url]http://blog.csdn.net/abc19900828/article/details/39500981[/url]
http://fgh2011.iteye.com/blog/1564283
[url]http://blog.csdn.net/abc19900828/article/details/39500981[/url]
http://fgh2011.iteye.com/blog/1564283