前言
学习java已经将近一年了,经常使用Spring、SpringBoot,但在工作中经常遇到bug,不会定位、解决。因此决定阅读源码,加深对框架的理解。
创建项目
-
勾选(作用在下文有提到)
2.命名
-
项目结构如下,勾选Spring的功能是下载Spring的jar包到lib中,勾选Web Application的作用是自动生成web文件夹,web.xml放一些配置,index.jsp是jsp页面。
-
接下来我们配置spring-config.xml文件在src之下。
<?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="user" class="com.learn.ioc.model.User">
<property name="name" value="小孙"/>
<property name="age" value="21"/>
</bean>
</beans>
- 运行