- 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
- 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
- Property ‘sqlSessionFactory‘ or ‘sqlSessionTemplate‘ are required
原因:mybatis-spring-1.3.2中取消了自动注入SqlSessionFactory 和 SqlSessionTemplate
解决:pom.xml中添加连接池的依赖
<dependency>