记录一下遇到的错误
Service、Mapper层里面的接口和类没加@service、@mapper注解,导致Spring无法将接口或者实现类扫描进容器中,导致在用到某个接口的实例化或者类的时候会在容器中找不到,就会报错
在父依赖的低版本中,可以在mapper层的接口不写@Mapper注解,不会报错
<parent>
<groupId>org.springframework.bootgroupId>
<artifactId>spring-boot-starter-parentartifactId>
<version>2.1.3.RELEASEversion>
<relativePath/>
parent>
- 1
- 2
- 3
- 4
- 5
- 6
但是在高版本的父依赖中,mapper层的接口就必须写@Mapper注解,不写就会报错
<parent>
<groupId>org.springframework.bootgroupId>
<artifactId>spring-boot-starter-parentartifactId>
<version>2.5.3version>
<relativePath/>
parent>
- 1
- 2
- 3
- 4
- 5
- 6