1,bean实例化基本流程
2,流程基本演示
2.1,新建beans3.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.xsd">
<bean id="userDao" class="com.study.dao.impl.UserDaoImpl"></bean>
<bean id="userService" class="com.study.service.impl.UserServiceImpl"></bean>
</beans>
2.2,新建测试类 BeanCreateFlow
package com.study.demoTest;
import com.study.service.UserService;
import org.springframework.context.ApplicationContext;
import org.springframework.context.support.ClassPathXmlApplicationContext;
public class BeanCreateFlow {
public static void main(String[] args) {
ApplicationContext applicationContext =
new ClassPathXmlApplicationContext("beans3.xml");
UserService userService = (UserService)applicationContext.getBean("userService");
System.out.println(userService);
}
}
2.3 debugger
3,beanDefinition
4,流程总结