首页 > 编程语言 > 详细

Spring容器创建Bean失败问题(Spring Web)

时间:2019-10-03 10:31:07      阅读:145      评论:0      收藏:0      [点我收藏+]

 

在Spring项目中遇到 创建Bean失败问题。

严重: Exception sending context initialized event to listener instance of class org.springframework.web.context.ContextLoaderListener
org.springframework.beans.factory.BeanCreationException: 
Error creating bean with name
‘brandServiceImpl‘ defined in file BrandServiceImpl.class

 

而且,web.xml文件里有 配置文件的路径说明 applicationContext*.xml 。

  <context-param>
    <param-name>contextConfigLocation</param-name>
    <param-value>classpath*:applicationContext*.xml</param-value>
  </context-param>
  <listener>
    <listener-class>org.springframework.web.context.ContextLoaderListener</listener-class>
  </listener>

 

实际看到文件名是

技术分享图片

 

 所以把applicationContext*.xml改成applicationContext-*.xml,这样匹配效果更强。

 

再次运行,竟然正常了。

 

Spring容器创建Bean失败问题(Spring Web)

原文:https://www.cnblogs.com/wuyicode/p/11618952.html

(0)
(0)
   
举报
评论 一句话评论(0
关于我们 - 联系我们 - 留言反馈 - 联系我们:wmxa8@hotmail.com
© 2014 bubuko.com 版权所有
打开技术之扣,分享程序人生!