The unresolved import of org.springframework.data.jpa.repository.JpaRepository can be resolved by adding the necessary dependencies in the project's build file (Maven or Gradle) and ensuring that the version used is compatible with the version of Spring being used.
For example, in a Maven project, you can add the following dependencies in the pom.xml file:
<dependency>
<groupId>org.springframework.data</groupId>
<artifactId>spring-data-jpa</artifactId>
<version>VERSION</version>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-data-jpa</artifactId>
<version>VERSION</version>
</dependency>
In a Gradle project, you can add the following dependencies in the build.gradle file:
implementation 'org.springframework.boot:spring-boot-starter-data-jpa:VERSION'
implementation 'org.springframework.data:spring-data-jpa:VERSION'
After adding the dependencies, make sure to refresh the project and rebuild it to ensure that the new dependencies are taken into account.
Asked: 2022-03-09 11:00:00 +0000
Seen: 14 times
Last updated: Nov 19 '21