<?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:c = "http://www.springframework.org/schema/c"
xmlns:p="http://www.springframework.org/schema/p"
xsi:schemaLocation="http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans.xsd">
<!-- //需要一个无参的够着方法-->
<bean id="user" class="com.chen.pojo.User" p:age="18" p:name="chen"></bean>
<!-- 需要一个有参的构造方法-->
<bean id="user2" class="com.chen.pojo.User" c:age="20" c:name="li"></bean>
</beans>
@Test
public void run(){
ApplicationContext context=new ClassPathXmlApplicationContext("beansuser.xml");
User user = (User) context.getBean("user2");
User user1=(User) context.getBean("user");
System.out.println(user);
}