依赖错误
我遇到 xxRepository is not found 的原因在于依赖导入错误,使用springboot jpa需要导入以下依赖。
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-data-jpa</artifactId>
</dependency>
包未扫描到
根据网上的搜索,包未扫描到的情况很多,原因在@SpringbootApplication注解会扫描使用该注解的类的所在包及其子包,repository所在类不在其中就扫描不到了,可以在启动类添加@CompantScan注解来扫描