我有一个指向应用程序上下文文件的静态 main。在项目成为maven项目之前,我将“applicationContex.xml”保存在Netbeans的“”(即root)中。现在,当我运行我的代码时,我得到了显示的错误。
有人可以告诉我应用程序上下文文件的正确位置吗?
@Service
public class TestDriver {
public static void main(String[] args) {
ApplicationContext ctx = new ClassPathXmlApplicationContext("applicationContext.xml");
错误:
INFO: Loading XML bean definitions from class path resource [applicationContext.xml]
Exception in thread "main" org.springframework.beans.factory.BeanDefinitionStoreException: IOException parsing XML document from class path resource [applicationContext.xml]; nested exception is java.io.FileNotFoundException: class path resource [applicationContext.xml] cannot be opened because it does not exist
Directory of C:\NetBeansProjects\prj\trunk\src\main\java
8/15/2012 09:38 AM <DIR> .
8/15/2012 08:58 AM <DIR> ..
8/15/2012 09:38 AM 162 jcbc.properties
8/15/2012 09:38 AM 879 log4j.properties
8/15/2012 09:38 AM 1,691 applicationContext.xml
3 File(s) 2,732 bytes