关于Spring系统无法找到指定的文件

这几天在学习spring,在第一次搭建自己的配置环境后,运行helloworld,结果却报了个这样的错误

Exception in thread "main" org.springframework.beans.factory.BeanDefinitionStoreException: IOException parsing XML document from file [D:\javaPro\Spring_Intro\src\1.xml]; nested exception is java.io.FileNotFoundException: null (系统找不到指定的文件。)

于是各种百度,都说是xml文件没有放置在src目录下引起的,各位也看出来了,我的文件就是放置在src下并没有什么问题,并且加载的语句也没有问题,于是我开始了各种调试和对比,终于让我发现问题所在,就是配置文件(beans.xml),我使用的是NetBeans,并且配置文件也是由NetBeans生成的,所以最开始没有想到这上面

下面附上 正确的配置


<?xml version="1.0" encoding="UTF-8"?>
  <beans xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
      xmlns="http://www.springframework.org/schema/beans"
      xsi:schemaLocation="http://www.springframework.org/schema/beans
      http://www.springframework.org/schema/beans/spring-beans-3.0.xsd">
      <bean id="MoveDisk" class="com.lym.springtest.MoveDisk"></bean>
      <bean id="Computer" class="com.lym.springtest.Computer">
      <property name="usb" ref="MoveDisk">
      </property>
      </bean>
      
    </beans>

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值