spring-boot - Spring Boot REST 路径,例如配置文件和用户
问题描述
我有一个带有以下启动器的 Spring Boot 应用程序 我需要知道为什么我们有这些 REST 端点
{
_links: {
users: {
href: "http://localhost:8080/users"
},
profile: {
href: "http://localhost:8080/profile"
}
}
}
解决方案
这是因为你有Rest Repositories
依赖。
来自Spring Docs,
Spring Data REST 为每个导出的存储库提供了一个应用程序级配置文件语义 (ALPS) 文档。它包含有关 RESTful 转换和每个存储库的属性的信息。
Spring Data REST 应用程序的根目录是配置文件链接。假设您有一个包含人员和相关地址的应用程序,根文档将如下所示:
{
"_links" : {
"persons" : {
"href" : "http://localhost:8080/persons"
},
"addresses" : {
"href" : "http://localhost:8080/addresses"
},
"profile" : {
"href" : "http://localhost:8080/profile"
}
}
}
/users
是不是因为你可能将它作为一个端点,或者正如评论@marok
中提到的那样,它是因为UserRepository
以这种方式暴露的。
希望能帮助到你 !
推荐阅读
- c# - 上传附件时获取位置的完整路径
- c++ - 无法使用信号唤醒 POSIX 线程
- sql-server - 如何在 SQL Server 的行中获取“,”而不是“和”
- mysql - 节点 js 服务器,mysql db,返回不正确的日期值
- javascript - 自定义 Vimeo API 嵌入不在 Chrome 中自动播放
- python - Selenium Python - 网络驱动程序
- jenkins - 使用 Jenkins 版本 2.107.3 获得“致命:在 /root/apache-maven-3.5.3 中找不到任何可执行文件”。我是 CentOS
- mysql - 无法启动 mySQL “mysqld:参数太多(第一个额外是 'start')。”
- php - 使用 Symfony Finder 通过丢失文件排除目录
- python - Python - 语法无效