@SpringQueryMapper无法获取父类属性

时间:2019-03-08 06:06:34

标签: spring-cloud-feign feign

我正在使用spring-cloud-feign Greenwich.RELEASE版本。

示例1:

public class PageParameter {

  private int pageSize = 10;

  private int pageNumber = 1;

  public int getPageSize() {
    return pageSize;
  }

  public void setPageSize(int pageSize) {
    this.pageSize = pageSize;
  }

  public int getPageNumber() {
    return pageNumber;
  }

  public void setPageNumber(int pageNumber) {
    this.pageNumber = pageNumber;
  }
}

public class QueryModel extends PageParameter {

}

public interface QueryFeign {

  @GetMapping("/query")
  String get(@SpringQueryMap QueryModel query);
}

预期:[QueryFeign#get] ---> GET http://xxxxxx/query?pageNumber=1&pageSize=10 HTTP / 1.1 实际:[QueryFeign#get] ---> GET http://xxxxxx/query HTTP / 1.1

示例2:

public class PageParameter {

  private int pageSize = 10;

  private int pageNumber = 1;

  public int getPageSize() {
    return pageSize;
  }

  public void setPageSize(int pageSize) {
    this.pageSize = pageSize;
  }

  public int getPageNumber() {
    return pageNumber;
  }

  public void setPageNumber(int pageNumber) {
    this.pageNumber = pageNumber;
  }
}

public interface QueryFeign {

  @GetMapping("/query")
  String get(@SpringQueryMap PageParameter query);
}

预期:[QueryFeign#get] ---> GET http://xxxxxx/query?pageNumber=1&pageSize=10 HTTP / 1.1 实际:[QueryFeign#get] ---> GET http://xxxxxx/query?pageNumber=1&pageSize=10 HTTP / 1.1

为什么继承的属性使@SpringQueryMap不起作用

0 个答案:

没有答案