# spring-demo **Repository Path**: ithsf/spring-demo ## Basic Information - **Project Name**: spring-demo - **Description**: spring源码学习记录 - **Primary Language**: Java - **License**: Not specified - **Default Branch**: master - **Homepage**: None - **GVP Project**: No ## Statistics - **Stars**: 0 - **Forks**: 0 - **Created**: 2019-10-10 - **Last Updated**: 2021-04-17 ## Categories & Tags **Categories**: Uncategorized **Tags**: None ## README ##理解SpringIOC、DI、MVC的基本执行原理。 **IOC**的基本执行原理是根据配置文件扫描相应的类包,遍历类包中所有class类,通过反射生成这些类的实例,存储到ioc容器中。 **DI**的基本执行原理是对ioc容器中的实例进行扫描,找出注解是Autowired的属性,从ioc容器中取得属性对应的实例,赋值给对应属性。 **MVC**的基本实现原理是DI之后,对ioc容器中的实例进行扫描,取出有Controller注解的类,然后将类中每个方法对应的url,及方法本身放入到集合中。用户输入url点回车,请求就会传到Spring的DispatcherServlet类中,会调doGet或者doPost方法,根据方法参数中的HttpServletRequest对象可以获得用户请求的url,根据url到容器中取得url匹配的方法,执行方法。