<?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.atguigu.spring5.userDaoImpl"></bean>
<bean id="service" class="com.atguigu.spring5.Service">
<constructor-arg ref="user"></constructor-arg>
</bean>
</beans>
IOException parsing XML document from class path resource [lol.xml]; nested exception is java.io.FileNotFoundException: class path resource [lol.xml] cannot be opened because it does not exist
at org.springframework.beans.factory.xml.XmlBeanDefinitionReader.loadBeanDefinitions(XmlBeanDefinitionReader.java:342)
使用spring5框架注入对象
题主贴下 Test 类文件的代码,第 9 行文件地址配置有误,尝试修改为 classpath:com/atguigu/spring5/lol.xml
,要是还找不到确认下有没有把这个资源文件编译到类路径。
读取文件得路径不对