spring配置文件中,scope="singleton"和scope="prototype"的区别
singleton,在文档中是这么说的,
one shared instance, which will be returned by all calls to getBean with the given id
这个bean只被实例化一次,之后用bean name请求得到的都是同一个对象。不过这个单例只是局限于spring上下文的范围,不同于真正的单例,真正的单例保证每次类装载时都只有一个类实例。
prototype,
independent instance resulting from each call to getBean
每次请求都实例化一个bean对象。
在spring中,默认的是singleton。