<?xml version="1.0" encoding="UTF-8"?>
<beans xmlns="http://www.springframework.org/schema/beans"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://www.springframework.org/schema/beans
http://www.springframework.org/schema/beans/spring-beans.xsd">
<!--
用scope属性配置bean的作用域
1、singleton:单例的
默认值,在容器初始化时创建bean实例,在整个容器的生命周期内只创建一个bean
调用时直接调用已经创建好的那个bean,每次调用都是同一个bean
2、prototype:原型的
在容器初始化时不会创建bean的实例,在每次调用的时候创建,并返回一个新的实例
-->
<!--测试bean的作用域-->
<bean id="carBean" class="com.spring.cn.config.autowire.CarBean"
scope="prototype"/>
<!--<config id="carBean" class="com.spring.cn.configig.autowire.CarBean"-->
<!--scope="singleton"/>-->
</beans>