Live2D

spring的单例、原型模式

  1. bean作用域

    单例模式(spring默认机制)全局仅产生一个对象

     <bean id="user2" class="com.lix.pojo.User" c:age="18" c:name="ll" scope="singleton"/>
    
    

    原型模式:每次从容器中get的时候都会生成新的对象

     <bean id="user2" class="com.lix.pojo.User" c:age="18" c:name="ll" scope="prototype"/>
    

posted @ 2020-10-29 11:21  六爻呈乾  阅读(477)  评论(0编辑  收藏  举报