🔥码云GVP开源项目 12k star Uniapp+ElementUI 功能强大 支持多语言、二开方便! 广告
Scope: Singleton:每次拿到的bean都是一个bean Prototype:每次拿到的都是一个新的对象。在Action层推荐用Prototype 在xml的bean配置中指定Scope属性即可:如下代码 ~~~ <bean id="userService" class="com.spring.service.UserServiceImpl" scope="prototype"> <property name="userDao" ref="userDao"></property> </bean> ~~~ 集合注入的案例:List、Set和Map ~~~ <property name="someList"> <list> <value>a list element followed by a reference</value> <ref bean="myDataSource"/> </list> </property> <property name="adminEmails"> <props> <prop key="administrator">admin@some.org</prop> <prop key="support">support@some.org</prop> </props> </property> <property name="someMap"> <map> <entry> <key><value>yup an entry</value></key> <value>just some string</value> </entry> <entry> <key><value>yup a ref</value></key> <ref bean="myDataSource"> </entry> </map> </property> ~~~