Spring实例化bean
package com.itany.test; import org.junit.Test; import org.springframework.context.ApplicationContext; import org.springframework.context.support.ClassPathXmlApplicationContext; 编写配置文件beans.xml <?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-2.0.xsd"> <!-- id和name都能为bean取名,但是id不能包含特殊字符,name可以,因为id属性属于xml文档的属性 如果不包含特殊字符,建议使用id--> <!--class为要创建的实现类--> <bean id="personService