抛出的异常出现UnsatisfiedDependencyException和BeanCreationException

21-Nov-2019 13:03:36.860 WARNING [RMI TCP Connection(3)-127.0.0.1] org.springframework.web.context.support.XmlWebApplicationContext.refresh Exception encountered during context initialization - cancelling refresh attempt: org.springframework.beans.factory.UnsatisfiedDependencyException: Error creating bean with name 'dicServiceImpl': Unsatisfied dependency expressed through field 'typeDao'; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'dicTypeDao' defined in file [D:\ideaWorkspace\projectForCRM\crm\target\crm-1.0-SNAPSHOT\WEB-INF\classes\com\bjpowernode\crm\settings\dao\DicTypeDao.class]: Cannot resolve reference to bean 'sqlSessionFactory' while setting bean property 'sqlSessionFactory'; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'sqlSessionFactory' defined in class path resource [spring/applicationContext.xml]: Invocation of init method failed; nested exception is org.springframework.core.NestedIOException: Failed to parse config resource: class path resource [mybatis/mybatis-config.xml]; nested exception is org.apache.ibatis.builder.BuilderException: Error parsing SQL Mapper Configuration. Cause: org.apache.ibatis.builder.BuilderException: Error parsing Mapper XML. Cause: org.apache.ibatis.builder.BuilderException: Parsing error was found in mapping #{editTime,editBy}.  Check syntax #{property|(expression), var1=value1, var2=value2, ...} 
21-Nov-2019 13:03:36.864 INFO [RMI TCP Connection(3)-127.0.0.1] com.alibaba.druid.pool.DruidDataSource.info {dataSource-1} closed
21-Nov-2019 13:03:36.872 SEVERE [RMI TCP Connection(3)-127.0.0.1] org.springframework.web.context.ContextLoader.initWebApplicationContext Context initialization failed
 org.springframework.beans.factory.UnsatisfiedDependencyException: Error creating bean with name 'dicServiceImpl': Unsatisfied dependency expressed through field 'typeDao'; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'dicTypeDao' defined in file [D:\ideaWorkspace\projectForCRM\crm\target\crm-1.0-SNAPSHOT\WEB-INF\classes\com\bjpowernode\crm\settings\dao\DicTypeDao.class]: Cannot resolve reference to bean 'sqlSessionFactory' while setting bean property 'sqlSessionFactory'; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'sqlSessionFactory' defined in class path resource [spring/applicationContext.xml]: Invocation of init method failed; nested exception is org.springframework.core.NestedIOException: Failed to parse config resource: class path resource [mybatis/mybatis-config.xml]; nested exception is org.apache.ibatis.builder.BuilderException: Error parsing SQL Mapper Configuration. Cause: org.apache.ibatis.builder.BuilderException: Error parsing Mapper XML. Cause: org.apache.ibatis.builder.BuilderException: Parsing error was found in mapping #{editTime,editBy}.  Check syntax #{property|(expression), var1=value1, var2=value2, ...} 

解决这个异常问题,看抛出的异常最后一句都会有错误原因、提示哪里出错,找出现的位置,进行修改
这里是在mapper.xml文件中的字段赋值,将两个字段写在一个大括号中

  • 1
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 3
    评论
beans.factory.UnsatisfiedDependencyException是Spring框架中的一个异常类,它表示在创建bean时发生了依赖注入失败的情况。具体来说,当Spring容器在创建bean时,无法满足bean的依赖关系时,就会抛出这个异常。 通常情况下,这个异常是由于缺少所需的依赖或依赖配置错误引起的。可能的原因包括: - 在bean定义中未正确配置依赖项 - 所需的依赖项在容器中不存在 - 依赖项的类型不匹配 - 存在循环依赖等问题 解决这个异常的方法主要包括: 1. 检查bean的依赖注入配置,确保依赖项正确配置,包括注入类型和名字。 2. 检查依赖项是否被正确地声明和创建,并且在Spring容器中可用。 3. 检查是否存在循环依赖,如果有,则需要重新设计或调整依赖关系。 4. 查看异常堆栈跟踪,以获取更详细的错误消息和线索,以便定位和解决问题。 总之,当出现beans.factory.UnsatisfiedDependencyException异常时,需要仔细检查相关的依赖配置和容器中的bean定义,以确保正确配置和创建依赖项。 org.springframework.beans.factory.UnsatisfiedDependencyException: Error creating bean with name 'shiroFilter' defined in class path resource [com/cdzn/mhs/config/ShiroConfig.class]: Unsatisfied dependency expressed through method 'shiroFilter' parameter 0; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'securityManager' defined in class path resource mvn package,打包项目 如果是JavaSe的项目,打包成jar包如果是JavaWeb的项目,打包成war包 使用install方式就是将项目转换成为maven依赖存放在本地maven仓库中。就比如我的spring boot项目使用install后存在我本地maven仓库中路径是:E:\MavenRepository_IDEA\org\springframework\boot\项目名

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论 3
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值