代码之家  ›  专栏  ›  技术社区  ›  chiranjeevigk

配置文件和用户等Spring引导休息路径

  •  1
  • chiranjeevigk  · 技术社区  · 7 年前

    我有一个弹簧引导应用程序,启动程序如下 我需要知道为什么我们有这些剩余的终点

    < PRE> >代码> 链接:{ 用户:{ href:“http://localhost:8080/用户” } 配置文件:{ href:“http://localhost:8080/个人资料” } } } < /代码> < 我需要知道为什么我们有这些剩余的终点

    {
    _links: {
    users: {
    href: "http://localhost:8080/users"
    },
    profile: { 
    href: "http://localhost:8080/profile"
    }
    }
    }
    
    1 回复  |  直到 7 年前
        1
  •  1
  •   rdj7 Harika Krishna    7 年前

    这是因为你 Rest Repositories 附属国。

    Spring Docs ,

    SpringDataRest为每个导出的文件提供了一个应用程序级概要语义(ALPS)文档 储存库。它包含有关两个RESTful转换的信息 以及每个存储库的属性。

    SpringDataRest应用程序的根目录是一个配置文件链接。假设你 有一个同时包含个人和相关地址的应用程序,根文档 如下所示:

    {   
       "_links" : {
         "persons" : {
         "href" : "http://localhost:8080/persons"
        },
         "addresses" : {
         "href" : "http://localhost:8080/addresses"
        },
         "profile" : {
         "href" : "http://localhost:8080/profile" 
        }   
      } 
    }
    

    /users 是否存在,因为您可能将其作为终结点或 @marok 在评论中提到这是因为 UserRepository 就是这样暴露的。

    希望它有帮助!