私はSpringで手を濡らし、SpringとともにEclipseを使用しています。Bean にプロパティを注入するために、Eclipse を使用して非常に単純な Spring アプリケーションを作成しました。ただし、アプリケーションを実行しているときに、Spring が例外をスローし、Spring が Spring 構成ファイルを見つけられないようです。以下はスタックトレースです -
INFO: Loading XML bean definitions from class path resource [Beans.xml]
Exception in thread "main" org.springframework.beans.factory.BeanDefinitionStoreException: IOException parsing XML document from class path resource [Beans.xml]; nested exception is java.io.FileNotFoundException: class path resource [Beans.xml] cannot be opened because it does not exist
at org.springframework.beans.factory.xml.XmlBeanDefinitionReader.loadBeanDefinitions(XmlBeanDefinitionReader.java:341)
at org.springframework.beans.factory.xml.XmlBeanDefinitionReader.loadBeanDefinitions(XmlBeanDefinitionReader.java:302)
私は次のことを試しました -- ClassPathXmlApplicationContext メソッドにフルパスを指定してください --
ApplicationContext context = new ClassPathXmlApplicationContext("C:/Users/devshankhasharm/workspace/FinalPowerShell/src/src/main/Beans.xml");
また、Windows の ClassPath 変数を更新して、Spring 構成ファイルのパスを追加しました。しかし、何も機能しませんでした。どんなアイデアでも大歓迎です。