Имитация имени клиента в RequestInterceptor

У меня фальшивый клиент

@FeignClient(name = "client1")
public interface Client1 {

    @GetMapping("/hello")
    HelloResponse hello();
}

Как я могу получить имя client1 в RequestInterceptor?

public class HelloInterceptor implements RequestInterceptor {

    @Override
    public void apply(RequestTemplate requestTemplate) {
        // how to get "client1" here?
    }
}

person Grzegorz Witkowski    schedule 12.03.2019    source источник


Ответы (1)


requestTemplate.feignTarget().name()

Это даст имя клиента

person HarshaYerasi    schedule 04.06.2020
comment
Я не вижу такого способа. Какой версией вы пользуетесь? - person Joseph K. Strauss; 17.06.2020
comment
mvnrepository.com/artifact/org. springframework.cloud/ - person HarshaYerasi; 18.06.2020