假装和分页

Feign & Pageable

告诉我如何正确配置 Feign 和 Spring Pageable 的工作 这是我的 Feign 设置

feign:
  okhttp:
    enabled: true
  autoconfiguration:
    jackson:
      enabled: true
  client:
    config:
      default:
        connectTimeout: ${FEIGN_DEFAULT_CONNECT_TIMEOUT:10000}
        readTimeout: ${FEIGN_DEFAULT_READ_TIMEOUT:60000}
        loggerLevel: full
        errorDecoder: ru.core.config.TokenErrorDecoder
        retryer: ru.service.SudisTokenService

我的FeignClient

@FeignClient(name = "BaseCaseFeignClient", url = "${feign.services.host-backend.url}")
public interface BaseCaseFeignClient {
    @GetMapping("/api/cases/base")
    Page<BaseCaseEntityDto> getBaseCases(@SpringQueryMap BaseCaseEntityFilter filter, Pageable pageable);

    @PostMapping("/api/cases/base/search")
    Page<FoundRecordDto> searchCases(@RequestBody FilterSpecification filter, @SpringQueryMap Pageable pageable);
}

获取请求工作正常。 post 请求有问题。 我收到以下错误

"No property caseOpenDttm: DESC found for type BaseCaseEntity!"

而且在这种情况下,根本不会组装项目。

Page<FoundRecordDto> searchCases(@RequestBody FilterSpecification filter, Pageable pageable);

Caused by: java.lang.IllegalStateException: Method has too many Body parameters: public abstract org.springframework.data.domain.Page ru..BaseCaseFeignClient.searchCases(ru.ilter.shared.basecase.search.FilterSpecification,org.springframework.data.domain.Pageable)
Warnings:

原始请求

http://localhost:8081/cpt/api/cases/base/search?page=0&size=10&sort=caseOpenDttm,DESC

而不是这样的请求

http://172.24.14.103:30750/cpt/api/cases/base/search?serialVersionUID=1232825578694716871&size=10&page=0&sort=caseOpenDttm,DESC

假装发送

http://172.24.14.103:30750/cpt/api/cases/base/search?serialVersionUID=1232825578694716871&size=10&sort=caseOpenDttm%3A%20DESC&page=0

http://172.24.14.103:30750/cpt/api/cases/base/search?serialVersionUID=1232825578694716871&size=10&sort=caseOpenDttm: DESC&page=0

我找到了类似的解决方案https://github.com/spring-cloud/spring-cloud-openfeign/issues/146 问题是我已经有一个@RequestBody

更新 spring-cloud-version 到版本 3.0.2 帮助