`

当Spring管理Struts2时配置的scope="prototype"

 
阅读更多
Spring  scope="prototype"


spring 默认scope 是单例模式 scope="singleton"
这样只会创建一个Action对象
每次访问都是同一个Action对象,数据不安全
struts2 是要求 每次次访问 都对应不同的Action
scope="prototype" 可以保证 当有请求的时候 都创建一个Action对象

<bean id="testManager" class="com.sw.TestManagerImpl" scope="singleton" />

 <bean id="testManager" class="com.sw.TestManagerImpl" scope="prototype" />



参考:
1.线程安全:http://guo2168.iteye.com/blog/859067
2.http://yzmduncan.iteye.com/blog/789162
3.http://blog.csdn.net/gaoge19861207/article/details/4745830
分享到:
评论

相关推荐

Global site tag (gtag.js) - Google Analytics