SpringBoot问题汇总

  1. Unsatisfied dependency expressed through field ‘xxxMapper’; nested exception is org.springframework.beans.factory.NoSuchBeanDefinitionException: No qualifying bean of type ‘…xxxMapper’ available: expected at least 1 bean which qualifies as autowire candidate. Dependency annotations: {@org.springframework.beans.factory.annotation.Autowired(required=true)}

原因:没有扫描到mapper包下的xxxMapper类
解决:在主启动类上添加扫描mapper包的注解 @MapperScan(“xxx.xxx.xxx.mapper”)
引用

https://blog.csdn.net/xy631739211/article/details/116279448
https://blog.csdn.net/qq_45116737/article/details/115958858

  1. java: 无法访问org.springframework.boot.SpringApplication
    错误的类文件: /C:/…/.m2/repository/org/springframework/boot/spring-boot/3.0.0/spring-boot-3.0.0.jar!/org/springframework/boot/SpringApplication.class
    类文件具有错误的版本 61.0, 应为 52.0
    请删除该文件或确保该文件位于正确的类路径子目录中。

原因:Spring Boot 3.X最低搭配jdk17,61指jdk17, 52指jdk8
解决:pom.xml中降低Spring-boot-starter的版本或其他依赖的版本

	<parent>
        <groupId>org.springframework.boot</groupId>
        <artifactId>spring-boot-starter-parent</artifactId>
        <version>2.5.6</version> <!-- springboot2.X和jdk8 -->
        <relativePath/> <!-- lookup parent from repository -->
 	</parent>

引用

https://blog.csdn.net/qq_49619863/article/details/128047256

  1. Property ‘sqlSessionFactory‘ or ‘sqlSessionTemplate‘ are required

原因:mybatis-spring-1.3.2中取消了自动注入SqlSessionFactory 和 SqlSessionTemplate
解决:pom.xml中添加连接池的依赖

    <dependency>
  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 1
    评论

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

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

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值