<bean id="id名" class="类名" scope="prototype/singleton"/>
scope可以取值singleton和prototype:
(1)singleton:每次调用getBean方法的时候返回同一个实例,默认的也是singleton。
(2)prototype:每次调用getBean方法的时候返回不同的实例。
<bean id="id名" class="类名" scope="prototype/singleton"/>
scope可以取值singleton和prototype:
(1)singleton:每次调用getBean方法的时候返回同一个实例,默认的也是singleton。
(2)prototype:每次调用getBean方法的时候返回不同的实例。