二三九九
IntelliJ IDEA无法读取src下的配置文件 报错找不到 解决方案
在线助手博客首页
###Hello world!
**问题描述:如下在IntelliJ IDEA中中读取spring配置文件时报错,但是在eclipse中却正常,无报错** ```xml 信息: Loading XML bean definitions from class path resource [bean.xml] Exception in thread "main" org.springframework.beans.factory.BeanDefinitionStoreException: IOException parsing XML document from class path resource [bean.xml]; nested exception is java.io.FileNotFoundException: class path resource [bean.xml] cannot be opened because it does not exist at org.springframework.beans.factory.xml.XmlBeanDefinitionReader.loadBeanDefinitions(XmlBeanDefinitionReader.java:343) at org.springframework.beans.factory.xml.XmlBeanDefinitionReader.loadBeanDefinitions(XmlBeanDefinitionReader.java:303) at com.spring.ioc.Application.main(Application.java:25) Caused by: java.io.FileNotFoundException: class path resource [bean.xml] cannot be opened because it does not exist at org.springframework.core.io.ClassPathResource.getInputStream(ClassPathResource.java:180) at org.springframework.beans.factory.xml.XmlBeanDefinitionReader.loadBeanDefinitions(XmlBeanDefinitionReader.java:329) ... 2 more ``` idea对这些配置的文件方式很明显和eclipse是不同的。在idea中有一个 [Content Roots](https://www.jetbrains.com/help/idea/2016.2/configuring-content-roots.html)的概念。需要为每一个folder配置相应的Content Roots。 所以需要加入如下配置即可 ```xml
/src
**/*.properties
**/*.xml
``` 完整配置如图  > 本文是 [在线助手|在线工具箱](https://www.it399.com/) 原创,**转载请注明来自 在线助手博客频道:IntelliJ IDEA无法读取src下的配置文件 报错找不到,原文链接**:https://www.it399.com/blog/web/20180409.jsp
网站快速导航
json在线格式化
阿拉伯数字转大写
彩色二维码模板
元宵节祝福制作
拆迁补偿协议
彩色二维码生成
Md5|Sha|Crc计算
Aes加密解密
图片base6编码工具
色彩搭配方案
图片取色工具
图片圆角制作工具
足迹地图生成器
词云标签云生成器
高考准考证在线制作
gif在线转视频
我的七夕预测
在线助手博客
Web后台开发
Web前端开发
Android移动开发
Python开发
linux运维开发
ffmpeg编码解码
赵丽颖冯晓峰
Copyright © 2017-2018 . All Rights Reserved.
粤ICP备18008506号