Spring beanFactory的singleton与prototype

action用prototype,service和dao用singleton
因为service和dao是无状态的,所以用singleton,而控制器却相反

这里的“状态”指的是具有属性性质的成员变量。

比如:Student 类中有个 name 字段,这个 name 字段就是“状态”,因为根据每个 Student 对象的不同,其中的 name 也是不同的。

猜你喜欢

转载自chinagdvea.iteye.com/blog/1062945
今日推荐