From 4407da95c1ba2396d592c4be1e8f28535b0ab96b Mon Sep 17 00:00:00 2001 From: MicuEmerson Date: Wed, 2 Jun 2021 20:57:42 +0300 Subject: [PATCH] BAEL-4014 - added the code --- .../baeldung/cloud/openfeign/client/UserClient.java | 13 +++++++++++++ .../cloud/openfeign/config/FeignConfig.java | 12 ++++++++++++ 2 files changed, 25 insertions(+) create mode 100644 spring-cloud/spring-cloud-openfeign/src/main/java/com/baeldung/cloud/openfeign/client/UserClient.java create mode 100644 spring-cloud/spring-cloud-openfeign/src/main/java/com/baeldung/cloud/openfeign/config/FeignConfig.java diff --git a/spring-cloud/spring-cloud-openfeign/src/main/java/com/baeldung/cloud/openfeign/client/UserClient.java b/spring-cloud/spring-cloud-openfeign/src/main/java/com/baeldung/cloud/openfeign/client/UserClient.java new file mode 100644 index 0000000000..9416bd30f0 --- /dev/null +++ b/spring-cloud/spring-cloud-openfeign/src/main/java/com/baeldung/cloud/openfeign/client/UserClient.java @@ -0,0 +1,13 @@ +package com.baeldung.cloud.openfeign.client; + +import com.baeldung.cloud.openfeign.config.FeignConfig; +import org.springframework.cloud.openfeign.FeignClient; +import org.springframework.web.bind.annotation.RequestMapping; +import org.springframework.web.bind.annotation.RequestMethod; + +@FeignClient(name = "user-client", url="https://jsonplaceholder.typicode.com", configuration = FeignConfig.class) +public interface UserClient { + + @RequestMapping(value = "/users", method = RequestMethod.GET) + String getUsers(); +} \ No newline at end of file diff --git a/spring-cloud/spring-cloud-openfeign/src/main/java/com/baeldung/cloud/openfeign/config/FeignConfig.java b/spring-cloud/spring-cloud-openfeign/src/main/java/com/baeldung/cloud/openfeign/config/FeignConfig.java new file mode 100644 index 0000000000..d51e97b9e4 --- /dev/null +++ b/spring-cloud/spring-cloud-openfeign/src/main/java/com/baeldung/cloud/openfeign/config/FeignConfig.java @@ -0,0 +1,12 @@ +package com.baeldung.cloud.openfeign.config; + +import feign.Logger; +import org.springframework.context.annotation.Bean; + +public class FeignConfig { + + @Bean + Logger.Level feignLoggerLevel() { + return Logger.Level.FULL; + } +} \ No newline at end of file