我可以知道为什么在开发第一个春季程序时发生这种异常

时间:2017-04-02 22:29:14

标签: spring

Apr 03, 2017 3:53:58 AM org.springframework.beans.factory.xml.XmlBeanDefinitionReader loadBeanDefinitions
INFO: Loading XML bean definitions from class path resource [spconfig.xml]
Exception in thread "main" org.springframework.beans.factory.BeanDefinitionStoreException: IOException parsing XML document from class path resource [spconfig.xml]; nested exception is java.io.FileNotFoundException: class path resource [spconfig.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)
at org.springframework.beans.factory.xml.XmlBeanFactory.<init>(XmlBeanFactory.java:73)
at org.springframework.beans.factory.xml.XmlBeanFactory.<init>(XmlBeanFactory.java:61)
at springcoreproject.Client.main(Client.java:9)
Caused by: java.io.FileNotFoundException: class path resource [spconfig.xml] cannot be opened because it does not exist
at org.springframework.core.io.ClassPathResource.getInputStream(ClassPathResource.java:142)
at org.springframework.beans.factory.xml.XmlBeanDefinitionReader.loadBeanDefinitions(XmlBeanDefinitionReader.java:328)
... 4 more

1 个答案:

答案 0 :(得分:0)

将spring core jar文件添加到类路径中。

您可以在http://javatpoint.com/src/sp/spcorejars.zip

下载文件

有关设置第一个弹簧应用程序的更多信息,请参阅http://javatpoint.com/steps-to-create-spring-application