java_spring_bean的作用域_实例是否为单实例
<?xml version="1.0" encoding="UTF-8"?> <beans xmlns="http://www.springframework.org/schema/beans" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:p="http://www.springframework.org/schema/p" xsi:schemaLocation="http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-3.0.xsd"> <!-- 延迟初始化,单实例, 默认也是单实例 --> <bean id="personService" class="com.bean.www.PersonServiceBean" lazy-init="true"></bean> <!-- 获取bean 每次创建都是一个新的对象--> <bean id="personService2" class="com.bean.www.PersonServiceBean" scope="prototype"></bean> </beans>