Error creating bean with name ‘userController‘: Unsatisfied dependency expressed through field ...

原因分析:添加了JSON类型处理器 :@TableField(typeHandler = JacksonTypeHandler.class)

今天在使用MP的提供CRUD方法把User实体中的某个类类型的属性与对应数据库表中的JSON类型的字段进行互转:
在类上开启自动映射并在类的属性(类类型)上添加Json类型处理器,添加后Mp会自动将该指定的属性与数据库字段互转,但之前自定义的SQL没自动转换,所以就报错了。
 


报错内容:
org.springframework.beans.factory.UnsatisfiedDependencyException: Error creating bean with name 'userController': Unsatisfied dependency expressed through field 'userService': Error creating bean with name 'userServiceImpl': Injection of resource dependencies failed

  • 1
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 1
    评论
'userService'; nested exception is org.springframework.beans.factory.UnsatisfiedDependencyException: Error creating bean with name 'userServiceImpl': Unsatisfied dependency expressed through field 'userMapper'; nested exception is org.springframewo。如何解决这个问题? 回答: 这个报错是由于在Spring项目中,创建名为'userController'的bean时,发现依赖的'userService'无法满足。具体报错信息可能有多种形式,如引用[1]和引用[3]所示。其中,引用[1]中的报错信息表明'userController'依赖的'userService'又依赖于'userMapper',而'userMapper'无法满足依赖。引用[3]中的报错信息则更详细地描述了解决过程中的一些尝试。 解决这个问题的方法有多种,以下是一些常见的解决方案: 1. 确保依赖的bean已经正确地配置和注册。检查配置文件,确保'userService'和'userMapper'的bean定义正确,并且已经被正确地扫描和注册到Spring容器中。 2. 检查依赖注入的注解。确保在'userController'中使用了正确的注解来注入'userService',例如@Autowired注解。 3. 检查依赖的类和接口的包路径。确保'userService'和'userMapper'的包路径正确,以便Spring能够正确地扫描和识别它们。 4. 检查依赖的版本兼容性。有时候,依赖的版本不兼容可能导致无法满足依赖。确保所有依赖的版本兼容,并且没有冲突。 5. 检查依赖的类和接口的命名规范。确保'userService'和'userMapper'的命名符合Spring的命名规范,以便Spring能够正确地识别它们。 根据具体的报错信息和项目配置,可以根据上述解决方案逐一排查和解决问题。

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

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

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值