java - Spring Boot JpaRepository 未导入
问题描述
你好我是初学者,刚开始学习弹簧靴并坚持这一点。我正在尝试创建一个 CRUD 应用程序,但 JpaRepository 无法正常工作。
pom.xml(这些是依赖项)
<dependencies>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-data-jpa</artifactId>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-thymeleaf</artifactId>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-web</artifactId>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-web-services</artifactId>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-devtools</artifactId>
<scope>runtime</scope>
<optional>true</optional>
</dependency>
<dependency>
<groupId>mysql</groupId>
<artifactId>mysql-connector-java</artifactId>
<scope>runtime</scope>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-test</artifactId>
<scope>test</scope>
</dependency>
</dependencies>
下面是未导入的服务类图像: 类图像
解决方案
您还必须包括spring-boot-starter-data-jpa
依赖项。
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-data-jpa</artifactId>
</dependency>
推荐阅读
- r - 使用特定值从相关矩阵中提取行名和列名
- rxjs - Angular 11反应形式订阅输入订阅的值变化无限
- javascript - 如何使用 JavaScript 或 jQuery 仅在移动视图上重新排序 li 元素?
- c# - 如何使用不同的参数多次设置相同的方法?
- winapi - 使用 Windows API 设置文件的权限
- android - Flutter Xcode 构建失败:未定义符号:_OBJC_CLASS_$_GeneratedPluginRegistrant
- qr-code - 有没有办法绝对确定访问来自二维码扫描?
- python-3.x - Python从指定发件人的电子邮件中提取链接
- cs-script - CS 脚本和实体框架
- mysql - 高效的数据库架构