The type org.springframework.data.repository.PagingAndSortingRepository cannot be resolved. It is indirectly referenced from required .class files

huangapple go评论51阅读模式
英文:

The type org.springframework.data.repository.PagingAndSortingRepository cannot be resolved. It is indirectly referenced from required .class files

问题

这个特定错误显示在控制台中。类型 org.springframework.data.domain.Sort 无法解析。它是从必需的 .class 文件间接引用的。
英文:
package com.gk.rating.service.repo;

import java.util.List;

import org.springframework.data.mongodb.repository.MongoRepository;
import org.springframework.stereotype.Repository;

import com.gk.rating.service.entity.Rating;

@Repository
public interface RatingRepository extends MongoRepository<Rating, String> {

	// custom finder methods
	List<Rating> findByUserId(String userId);

	List<Rating> findByHotelId(String hotelId);
}

This particular error is showing in console.The type org.springframework.data.domain.Sort cannot be resolved. It is indirectly referenced from required .class files

答案1

得分: 1

请将以下内容添加到 pom.xml 文件中。初始时,可以尝试省略版本号。

<dependency>
    <groupId>org.springframework.data</groupId>
    <artifactId>spring-data-commons</artifactId>
    <version>3.0.1</version>
</dependency>
英文:

Try adding this to the pom.xml. Try with version left out for starters.

&lt;dependency&gt;
    &lt;groupId&gt;org.springframework.data&lt;/groupId&gt;
    &lt;artifactId&gt;spring-data-commons&lt;/artifactId&gt;
    &lt;version&gt;3.0.1&lt;/version&gt;
&lt;/dependency&gt;

huangapple
  • 本文由 发表于 2023年2月7日 04:24:45
  • 转载请务必保留本文链接:https://go.coder-hub.com/75366201.html
匿名

发表评论

匿名网友

:?: :razz: :sad: :evil: :!: :smile: :oops: :grin: :eek: :shock: :???: :cool: :lol: :mad: :twisted: :roll: :wink: :idea: :arrow: :neutral: :cry: :mrgreen:

确定