记录错误Error creating bean with name ‘xxxx‘: Unsatisfied dependency expressed through field ‘xxxx‘

详细报错:

org.springframework.beans.factory.UnsatisfiedDependencyException: 
Error creating bean with name 'sysMenuController': Unsatisfied dependency expressed through field 'menuService'; 
nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'sysMenuServiceImpl': Injection of resource dependencies failed; 
nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'sysRoleMenuServiceImpl': Injection of resource dependencies failed; 
nested exception is org.springframework.beans.factory.UnsatisfiedDependencyException: Error creating bean with name 'sysRoleMenuMapper' defined in file [C:\Users\chey\Desktop\td-srv\td-srv\ims-business\user-center\target\classes\com\bf\ims\user\mapper\SysRoleMenuMapper.class]: Unsatisfied dependency expressed through bean property 'sqlSessionFactory'; 
nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'sqlSessionFactory' defined in class path resource [com/baomidou/mybatisplus/autoconfigure/MybatisPlusAutoConfiguration.class]: Bean instantiation via factory method failed; 
nested exception is org.springframework.beans.BeanInstantiationException: Failed to instantiate [org.apache.ibatis.session.SqlSessionFactory]: Factory method 'sqlSessionFactory' threw exception; 
nested exception is org.springframework.core.NestedIOException: Failed to parse mapping resource: 'file [C:\Users\chey\Desktop\td-srv\td-srv\ims-business\user-center\target\classes\mapper\SysRoleMapper.xml]'; 
nested exception is org.apache.ibatis.builder.BuilderException: Error parsing Mapper XML. The XML location is 'file [C:\Users\chey\Desktop\td-srv\td-srv\ims-business\user-center\target\classes\mapper\SysRoleMapper.xml]'. 
Cause: org.apache.ibatis.builder.BuilderException: Error resolving class. 
Cause: org.apache.ibatis.type.TypeException: Could not resolve type alias 'com.bf.soil.base.model.SysRole'.  
Cause: java.lang.ClassNotFoundException: Cannot find class: com.bf.soil.base.model.SysRole

分析报错

Error creating bean with name 'sysMenuController': Unsatisfied dependency expressed through field 'menuService'; 

百度出来这段错大概是因为

  • service层service注解问题
  • mapper层mapper注解问题 层级问题
  • 启动类mapperscan注解扫描问题
  • 包冲突问题 确实在两个服务中分别存在两个版本的mybatis
  • maven问题 依赖里的插件爆红,不知道有无影响

目前没能解决

  • 0
    点赞
  • 1
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
引用\[1\]中提到了一个错误创建bean的异常,该异常是由于在helloController中的userService字段上存在依赖注入失败的问题。具体原因是找不到符合自动装配条件的com.cloud.xp.manager.service.UserService bean。\[1\] 引用\[2\]中提供了一个applicationContext-datasource.xml的配置文件,其中配置了数据源的相关信息,包括驱动类名、用户名、密码和URL等。\[2\] 引用\[3\]中指出了可能的问题是userService对象不存在,导致注入失败,并抛出了错误创建bean的异常。建议检查UserService接口的实现类是否添加了@Service注解,以确保该实现类被正确地添加到容器中。\[3\] 综上所述,错误创建bean的异常是由于依赖注入失败导致的。可能的原因是userService对象不存在或未正确添加到容器中。建议检查UserService接口的实现类是否添加了@Service注解,并确保配置文件中的数据源信息正确无误。 #### 引用[.reference_title] - *1* *3* [解决异常Error creating bean with name ‘xxxxxController‘: Unsatisfied dependency expressed through ...](https://blog.csdn.net/qq_38701478/article/details/88808628)[target="_blank" data-report-click={"spm":"1018.2226.3001.9630","extra":{"utm_source":"vip_chatgpt_common_search_pc_result","utm_medium":"distribute.pc_search_result.none-task-cask-2~all~insert_cask~default-1-null.142^v91^insert_down1,239^v3^insert_chatgpt"}} ] [.reference_item] - *2* [Error creating bean with name ‘userService‘: Unsatisfied dependency expressed through field](https://blog.csdn.net/m0_52288433/article/details/127948405)[target="_blank" data-report-click={"spm":"1018.2226.3001.9630","extra":{"utm_source":"vip_chatgpt_common_search_pc_result","utm_medium":"distribute.pc_search_result.none-task-cask-2~all~insert_cask~default-1-null.142^v91^insert_down1,239^v3^insert_chatgpt"}} ] [.reference_item] [ .reference_list ]

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

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

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值