bean无法自动装配

报错记录

报错详情

 Error creating bean with name 'saleLeadsController': Unsatisfied dependency expressed through field 'saleLeadsService'; nested exception is org.springframework.beans.factory.UnsatisfiedDependencyException: Error creating bean with name 'saleLeadsService': Unsatisfied dependency expressed through field 'saleLeadsMapper'; nested exception is org.springframework.beans.factory.UnsatisfiedDependencyException: Error creating bean with name 'saleLeadsMapper' defined in file [E:\IdeaProjects\kindo-oms\server\target\classes\com\kindo\oms\mapper\SaleLeadsMapper.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 [org/mybatis/spring/boot/autoconfigure/MybatisAutoConfiguration.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 [E:\IdeaProjects\kindo-oms\server\target\classes\mapper\SaleLeadsMapper.xml]'; nested exception is org.apache.ibatis.builder.BuilderException: Error parsing Mapper XML. The XML location is 'file [E:\IdeaProjects\kindo-oms\server\target\classes\mapper\SaleLeadsMapper.xml]'. Cause: java.lang.IllegalArgumentException: Result Maps collection already contains value for com.kindo.oms.mapper.SaleLeadsMapper.BaseResultMap

总结
1 mapper,service,controller层注解检查,
2 查看启动类mapper
@MapperScan(basePackages = “com.kindo.oms.mapper”)
3 代码生成器重复生成,不会覆盖原有的,会在xml里面往后面加一样的 <resultMap 》…,仔细检查xml
4 查错教程------Mybatis报错 Result Maps collection already contains value for 原因汇总
https://blog.csdn.net/flystarfly/article/details/106195858

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
Spring bean的自动装配是指在Spring容器中,Spring会根据一定的规则自动为bean注入它所依赖的其他bean的属性。其中,有三种常见的自动装配方式。 第一种是根据名称进行自动装配,即根据属性的名称在容器中查找对应的bean进行注入。这种方式称为ByName自动装配。 第二种是根据类型进行自动装配,即根据属性的类型在容器中查找对应的唯一bean进行注入。这种方式称为ByType自动装配。需要注意的是,所有被注入的bean的类必须保持唯一,并且与自动注入的属性类型一致。 第三种方式是通过注解实现自动装配,即使用注解来标识需要进行自动装配的属性。通过配置相应的注解,Spring会在容器中查找匹配的bean并进行注入。这种方式更加灵活和方便。 总结来说,Spring自动装配可以通过属性名称、属性类型或注解来实现,使得开发者无需手动进行属性注入,提高了开发效率和代码的可维护性。<span class="em">1</span><span class="em">2</span><span class="em">3</span> #### 引用[.reference_title] - *1* *2* *3* [SpringBean的自动装配](https://blog.csdn.net/weixin_44107140/article/details/119154162)[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^v93^chatsearchT3_2"}}] [.reference_item style="max-width: 100%"] [ .reference_list ]

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

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

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值