无法在spring中访问XML文件

问题描述 投票:0回答:1

我使用spring并且无法读取Spring.xml文件。 ApplicationContext context = new ClassPathXmlApplicationContext(“Spring.xml”);向我显示此错误:引起:java.io.FileNotFoundException:类路径资源[Spring.xml]无法打开,因为它不存在

xml pathemphasized text

xml spring spring-framework-beans
1个回答
0
投票

我建议使用Maven生成一个新项目。回答你的问题重构你的项目如下,它将能够在类路径上找到xml

src/main/java - 所有课程

src/main/resources - 所有配置,属性,xml等

© www.soinside.com 2019 - 2024. All rights reserved.