我得到这个答复:
{
"timestamp": "2020-04-15T06:39:29.174+0000",
"status": 404,
"error": "Not Found",
"message": "No message available",
"path": "/api/users"
}
当我在以下位置发送GET
请求时:>>
http://localhost:8080/api/users
具有以下
@RepositoryRestResource
的端点:
@RepositoryRestResource(collectionResourceRel = "api/users", path = "api/users") public interface UserRestRepository extends CrudRepository<User, Integer> { }
带有
dependencies
:
<dependencies> <dependency> <groupId>org.springframework.boot</groupId> <artifactId>spring-boot-starter-web</artifactId> </dependency> <dependency> <groupId>org.springframework.boot</groupId> <artifactId>spring-boot-starter-data-rest</artifactId> </dependency> <dependency> <groupId>org.springframework.boot</groupId> <artifactId>spring-boot-starter-data-jpa</artifactId> </dependency> <dependency> <groupId>org.springframework.boot</groupId> <artifactId>spring-boot-starter-security</artifactId> </dependency> <dependency> <groupId>org.springframework.boot</groupId> <artifactId>spring-boot-configuration-processor</artifactId> <optional>true</optional> </dependency> </dependencies>
问题是我上面的配置中缺少什么?还有使用Spring Data REST的其他设置吗?
我对Spring Data REST完全陌生。
我正在作为响应:{“ timestamp”:“ 2020-04-15T06:39:29.174 + 0000”,“ status”:404,“ error”:“未找到”,“ message”:“没有消息可用”,“路径”:“ / api / users”},当...
您的所有配置看起来都不错,但是可以通过仅附加以下内容来解决您的问题: