默认的配置。 Prototype: 每次对bean的请求都会创建一个新的bean实例。
二者选择的原则:有状态的bean都使用Prototype作用域,而对无状态的bean则应该使用singleton作用域。
在 Spring2.0中除了以前的Singleton和Prototype外又加入了三个新的web作用域,
分别为request、session和 global session

解决方案 »

  1.   

    bean的作用域官方参考手册都有详细说明的默认是类似于单例的singleton
      

  2.   

     <!-- ========================= RESOURCE DEFINITIONS ========================= -->
      <bean id="dataSource" class="org.springframework.jndi.JndiObjectFactoryBean">
        <property name="jndiName" value="jdbc/exoa"/>
      </bean>
      <bean id="transactionManager" class="org.springframework.jdbc.datasource.DataSourceTransactionManager">
        <property name="dataSource">
          <ref local="dataSource"/>
        </property>
      </bean>
      <bean id="sqlMapClient" class="org.springframework.orm.ibatis.SqlMapClientFactoryBean">
        <property name="configLocation">
          <value>/com/excellence/gzby/standard/bean/iBatis-config.xml</value>
        </property>
      </bean> 一般默认