【问题标题】:Spring Data Rest search endpointSpring Data Rest 搜索端点
【发布时间】:2016-07-11 01:25:24
【问题描述】:

我们正在尝试在其余端点中采用标准化,并想知道为什么 Spring Data Rest 使用“搜索”端点公开 FindBy 操作。例如http://localhost:8080/ws_springtcri_next/events/search/findByEventCityIn。这是标准原则吗?

public interface EventRepository extends JpaRepository<Event, Integer>,
    JpaSpecificationExecutor<Event>, 
    QueryDslPredicateExecutor<Event> {
        Page<Event> findByEventCityIn(
            @Param("eventCity") Collection<String> cities, Pageable pageable);
    }

【问题讨论】:

    标签: spring-data-rest


    【解决方案1】:

    所有查询存储库方法资源都暴露在搜索资源下,因为它们在 db 中搜索符合某些条件的实体。您无法更改此 /search 网址。如果你真的需要一个没有搜索的链接,你应该通过使用注释 @RepositoryRestController 编写你自己的控制器来覆盖实体的响应处理程序

    【讨论】:

      猜你喜欢
      • 2015-12-23
      • 2019-04-19
      • 2014-12-19
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2015-08-13
      • 2018-03-17
      相关资源
      最近更新 更多