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.
Please start posting anonymously - your entry will be published after you log in or create a new account. This space is reserved only for answers. If you would like to engage in a discussion, please instead post a comment under the question or an answer that you would like to discuss
Asked: 2022-03-09 11:00:00 +0000
Seen: 14 times
Last updated: Nov 19 '21