运行项目日志提示:Loading XML bean definitions from class path resource [applicationContext.xml]

导读:本篇文章讲解 运行项目日志提示:Loading XML bean definitions from class path resource [applicationContext.xml],希望对大家有帮助,欢迎收藏,转发!站点地址:www.bmabk.com

提示:

日志打印Loading XML bean definitions from class path resource [applicationContext.xml]一般是获取applicationContext.xml失败。

例:

 applicationContext.xml所在位置如下(左),service写一个save()方法。applicationContext.xml配置内容省略…

运行项目日志提示:Loading XML bean definitions from class path resource [applicationContext.xml]运行项目日志提示:Loading XML bean definitions from class path resource [applicationContext.xml]

写个@Test测试类通过ClassPathXmlApplicationContext获取spring的配置文件applicationContext.xml 。

运行项目日志提示:Loading XML bean definitions from class path resource [applicationContext.xml]运行项目失败(什么也没打印出来),日志提示:

[org.springframework.beans.factory.xml.XmlBeanDefinitionReader]-[INFO] Loading XML bean definitions from class path resource [applicationContext.xml]

 全部日志:

2019-12-19 14:53:32,285 [main] [org.springframework.core.env.StandardEnvironment]-[DEBUG] Adding [systemProperties] PropertySource with lowest search precedence
2019-12-19 14:53:32,289 [main] [org.springframework.core.env.StandardEnvironment]-[DEBUG] Adding [systemEnvironment] PropertySource with lowest search precedence
2019-12-19 14:53:32,289 [main] [org.springframework.core.env.StandardEnvironment]-[DEBUG] Initialized StandardEnvironment with PropertySources [systemProperties,systemEnvironment]
2019-12-19 14:53:32,293 [main] [org.springframework.context.support.ClassPathXmlApplicationContext]-[INFO] Refreshing org.springframework.context.support.ClassPathXmlApplicationContext@40b73194: startup date [Thu Dec 19 14:53:32 CST 2019]; root of context hierarchy
2019-12-19 14:53:32,346 [main] [org.springframework.core.env.StandardEnvironment]-[DEBUG] Adding [systemProperties] PropertySource with lowest search precedence
2019-12-19 14:53:32,346 [main] [org.springframework.core.env.StandardEnvironment]-[DEBUG] Adding [systemEnvironment] PropertySource with lowest search precedence
2019-12-19 14:53:32,347 [main] [org.springframework.core.env.StandardEnvironment]-[DEBUG] Initialized StandardEnvironment with PropertySources [systemProperties,systemEnvironment]
2019-12-19 14:53:32,369 [main] [org.springframework.beans.factory.xml.XmlBeanDefinitionReader]-[INFO] Loading XML bean definitions from class path resource [applicationContext.xml]

我这运行失败原因是: applicationContext.xml放在src/main/resources/spring 目录下,获取applicationContext.xml配置文件的时候前边没有加spring目录。加上spring/后项目正常运行了。

运行项目日志提示:Loading XML bean definitions from class path resource [applicationContext.xml]

版权声明:本文内容由互联网用户自发贡献,该文观点仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌侵权/违法违规的内容, 请发送邮件至 举报,一经查实,本站将立刻删除。

文章由极客之音整理,本文链接:https://www.bmabk.com/index.php/post/15952.html

(0)
小半的头像小半

相关推荐

极客之音——专业性很强的中文编程技术网站,欢迎收藏到浏览器,订阅我们!