spring中遇到的问题以及解决方法
在idea中使用Maven创建web项目工程时,在运行下列代码 报错找不到bean.xml文件
ApplicationContext context=
new ClassPathXmlApplicationContext("bean.xml");
报错:
java.io.FileNotFoundException: class path resource [bean1.xml] cannot be opened because it does not exist.
解决方案:要把xml文件放在resource中,并把它改为resource root就可以解决了。
如下图: