spring找不到xml配置文件。
来源:互联网 发布:淘宝办理入台证靠谱吗 编辑:程序博客网 时间:2024/06/06 06:47
学Spring的时候,创建了一个resource目录,来放spring的xml配置文件。但是spring报错,找不到xml配置文件。
org.springframework.beans.factory.BeanDefinitionStoreException: IOException parsing XML document from class path resource [chapter2/helloworld.xml]; nested exception is java.io.FileNotFoundException: class path resource [chapter2/helloworld.xml] cannot be opened because it does not exist
目录结构如下:
实例化IOC容器的代码:ApplicationContext context = new ClassPathXmlApplicationContext("helloworld.xml");
后来尝试把helloworld.xml放在src目录和resource目录下都可以(不在包中)。于是把代码改成:
ApplicationContext context = new ClassPathXmlApplicationContext("chapter2/helloworld.xml");
问题解决。
阅读全文
0 0
- spring找不到xml配置文件。
- Spring程序找不到applicationContext.xml配置文件
- Spring程序找不到applicationContext.xml配置文件
- Spring配置文件applicationContext.xml 找不到的问题
- maven下spring ClassPathXmlApplicationContext找不到xml配置文件的问题
- 找不到spring配置文件
- Spring配置文件找不到的问题
- 关于springMVC deploy时 启动tomcat出现找不到spring的xml配置文件的原因
- spring配置文件xml文件开头总是有个红叉,是找不到schema文件
- spring的XML配置文件
- spring加载xml配置文件
- spring配置文件applicationContext.xml
- Spring:加载xml配置文件
- Spring的XML配置文件
- spring-security.xml 配置文件
- spring配置文件 applicationContext.xml
- Spring配置文件-applicationContext.xml
- spring加载xml配置文件
- spring boot 操作数据库出现乱码解决方案
- Kotlin学习总结(1)——Kotlin快速入门
- git分布式版本控制器基本命令
- 访问PC IO CMOS RAM(读取bios时间)
- 欢迎使用CSDN-markdown编辑器
- spring找不到xml配置文件。
- IntelliJ IDEA 控制台中文乱码
- C# 用Linq的方式实现对Xml文件的基本操作(创建xml文件、增删改查xml文件节点信息)
- 计算机网络课程笔记(三)
- channel
- Django 安装
- MP3编码分析
- UVA
- jquery改变元素属性值