搜索 API 未找到 EntityRepresentationModel

Search API EntityRepresentationModel not found

我正在尝试创建自定义搜索 API。

@RepositoryRestResource( collectionResourceRel = "products", path = "products" )
public interface ProductFamilyRepository extends JpaRepository<ProductFamily, UUID> {

   @RestResource( path = "pages", rel = "pages" )
   ProductFamily findByPageId( @Param( "pageId" ) String pageId );

执行 http://localhost:8080/products/search/pages?pageId=p33

org.springframework.data.rest.webmvc.ResourceNotFoundException: EntityRepresentationModel not found!
    at org.springframework.data.rest.webmvc.RepositorySearchController.lambda$toModel(RepositorySearchController.java:219)
    at java.base/java.util.Optional.orElseThrow(Optional.java:401)
    at org.springframework.data.rest.webmvc.RepositorySearchController.toModel(RepositorySearchController.java:219)
    at org.springframework.data.rest.webmvc.RepositorySearchController.executeSearch(RepositorySearchController.java:185)
    at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
    at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
    
    

我做错了什么?

问题是 return 类型。必须是 List<ProductFamily>