spring入门和基于XML的 IOC 细节
基于 XML 的配置: 1.创建 maven 工程并导入坐标 <dependencies> <dependency> <groupId>org.springframework</groupId> <artifactId>spring-context</artifactId> <version>5.0.2.RELEASE</version> </dependency> </dependencies> 2.在类的根路径下(resources目录)创建一个任意名称的 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"> </beans> 3.让 spring 管理资源