我有一个带有以下启动器的Spring Boot应用程序 我需要知道为什么我们有这些REST端点
{
_links: {
users: {
href: "http://localhost:8080/users"
},
profile: {
href: "http://localhost:8080/profile"
}
}
}
答案 0 :(得分:1)
这是因为您具有Rest Repositories
依赖性。
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
是以这种方式公开的。
希望有帮助!