【发布时间】:2018-10-01 16:02:34
【问题描述】:
我正在使用@FeignClient 注释。我想知道在运行我的应用程序时 Spring 注入了哪个 httpclient。
例如, OkHttpClient 和 ApacheHttpClient feign 客户端可以通过将 feign.okhttp.enabled 或 feign.httpclient.enabled 分别设置为 true 并将它们放在类路径中来使用。
import org.springframework.cloud.netflix.feign.FeignClient;
import org.springframework.http.MediaType;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
@FeignClient(name = "service", path = "/api/v1", configuration = ServiceConfiguration.class)
public interface ServiceClient {
@RequestMapping(method = RequestMethod.GET, value = "/test/{param1}", consumes = MediaType.APPLICATION_JSON_VALUE)
String test(@PathVariable("param1") String param);
}
我现在不确定这些客户端中的哪一个被注入,因为我的应用程序很复杂,在类路径中有多个 httpclient 库。
有什么方法可以监控吗?
我启用了 JMX 并尝试查看 jconsole Mbean,但没有关于 httpclients 的信息。
【问题讨论】:
-
您是否尝试过在 DEBUG 级别登录?
标签: spring-boot spring-cloud-netflix netflix-feign spring-cloud-feign