Java: значение по умолчанию в клиенте Feign - PullRequest
0 голосов
/ 05 мая 2020

Скажите, а как я могу установить значение по умолчанию в параметре в Feign client или другом?

Вот мой код. Я указал значение по умолчанию, но оно не работает: (

Сервис:

public Price get(PricesRequest request) {
        return  priceFeignClient.get(
                       request.getPrice(),
                       request.getAddress(),
                       request.getCode(),
                       request.getCurrency()
                )
}

Поддельный клиент:

public interface PriceFeignClient {
    @GetMapping
    Price get(@RequestParam("price") String price,
              @RequestParam("address") String Address,
              @RequestParam(value = "code", required = true, defaultValue = "AAA") String code,
              @RequestParam("currency") String currency
    );

Я хочу сделать значение по умолчанию для параметр "код" .

1 Ответ

1 голос
/ 08 мая 2020
• 1000
@RequestParam(value = "code", required = false, defaultValue = "AAA") String code

Обязательно: required = false (вместо required = true ).

...