| FazBrowse GitHub Viewer | Trending | | Home |
| Tools: [Download Repo ZIP] [Original HTTPS Page] |
1 parent 639de96 commit 09382f5
42 files changed
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -7,3 +7,8 @@ This module contains articles about Feign | |||
| 7 | 7 | - [Intro to Feign](https://www.baeldung.com/intro-to-feign) | |
| 8 | 8 | - [Retrying Feign Calls](https://www.baeldung.com/feign-retry) | |
| 9 | 9 | - [Setting Request Headers Using Feign](https://www.baeldung.com/java-feign-request-headers) | |
| 10 | + - [File Upload With Open Feign](https://www.baeldung.com/java-feign-file-upload) | ||
| 11 | + - [Feign Logging Configuration](https://www.baeldung.com/java-feign-logging) | ||
| 12 | + - [Retrieve Original Message From Feign ErrorDecoder](https://www.baeldung.com/feign-retrieve-original-message) | ||
| 13 | + - [RequestLine with Feign Client](https://www.baeldung.com/feign-requestline) | ||
| 14 | + - [Propagating Exceptions With OpenFeign and Spring](https://www.baeldung.com/spring-openfeign-propagate-exception) | ||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -64,6 +64,22 @@ | |||
| 64 | 64 | <artifactId>spring-boot-starter-test</artifactId> | |
| 65 | 65 | <scope>test</scope> | |
| 66 | 66 | </dependency> | |
| 67 | + <dependency> | ||
| 68 | + <groupId>io.github.openfeign.form</groupId> | ||
| 69 | + <artifactId>feign-form-spring</artifactId> | ||
| 70 | + <version>${feign.form.spring.version}</version> | ||
| 71 | + </dependency> | ||
| 72 | + <dependency> | ||
| 73 | + <groupId>org.springframework.cloud</groupId> | ||
| 74 | + <artifactId>spring-cloud-starter-openfeign</artifactId> | ||
| 75 | + <version>${spring.cloud.openfeign.version}</version> | ||
| 76 | + </dependency> | ||
| 77 | + <dependency> | ||
| 78 | + <groupId>com.github.tomakehurst</groupId> | ||
| 79 | + <artifactId>wiremock-jre8</artifactId> | ||
| 80 | + <version>${wire.mock.version}</version> | ||
| 81 | + <scope>test</scope> | ||
| 82 | + </dependency> | ||
| 67 | 83 | </dependencies> | |
| 68 | 84 | ||
| 69 | 85 | <build> | |
@@ -118,6 +134,9 @@ | |||
| 118 | 134 | <properties> | |
| 119 | 135 | <feign.version>11.8</feign.version> | |
| 120 | 136 | <wsdl4j.version>1.6.3</wsdl4j.version> | |
| 137 | + <feign.form.spring.version>3.8.0</feign.form.spring.version> | ||
| 138 | + <spring.cloud.openfeign.version>3.1.2</spring.cloud.openfeign.version> | ||
| 139 | + <wire.mock.version>2.33.2</wire.mock.version> | ||
| 121 | 140 | </properties> | |
| 122 | 141 | ||
| 123 | 142 | </project> | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -0,0 +1,16 @@ | |||
| 1 | + package com.baeldung.core; | ||
| 2 | + | ||
| 3 | + import org.springframework.boot.SpringApplication; | ||
| 4 | + import org.springframework.boot.autoconfigure.SpringBootApplication; | ||
| 5 | + import org.springframework.cloud.openfeign.EnableFeignClients; | ||
| 6 | + | ||
| 7 | + @SpringBootApplication | ||
| 8 | + @EnableFeignClients | ||
| 9 | + public class ExampleApplication { | ||
| 10 | + | ||
| 11 | + public static void main(String[] args) { | ||
| 12 | + SpringApplication.run(ExampleApplication.class, args); | ||
| 13 | + } | ||
| 14 | + | ||
| 15 | + } | ||
| 16 | + | ||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -1,6 +1,7 @@ | |||
| 1 | - package com.baeldung.cloud.openfeign.client; | ||
| 1 | + package com.baeldung.core.client; | ||
| 2 | + | ||
| 3 | + import com.baeldung.core.model.Employee; | ||
| 2 | 4 | ||
| 3 | - import com.baeldung.cloud.openfeign.model.Employee; | ||
| 4 | 5 | import feign.Headers; | |
| 5 | 6 | import feign.Param; | |
| 6 | 7 | import feign.RequestLine; | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -0,0 +1,13 @@ | |||
| 1 | + package com.baeldung.core.client; | ||
| 2 | + | ||
| 3 | + import org.springframework.cloud.openfeign.FeignClient; | ||
| 4 | + import org.springframework.web.bind.annotation.GetMapping; | ||
| 5 | + | ||
| 6 | + import com.baeldung.core.config.FeignConfig; | ||
| 7 | + | ||
| 8 | + @FeignClient(name = "user-client", url="https://jsonplaceholder.typicode.com", configuration = FeignConfig.class) | ||
| 9 | + public interface UserClient { | ||
| 10 | + | ||
| 11 | + @GetMapping(value = "/users") | ||
| 12 | + String getUsers(); | ||
| 13 | + } | ||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -1,8 +1,9 @@ | |||
| 1 | - package com.baeldung.cloud.openfeign.config; | ||
| 1 | + package com.baeldung.core.config; | ||
| 2 | 2 | ||
| 3 | - import feign.Logger; | ||
| 4 | 3 | import org.springframework.context.annotation.Bean; | |
| 5 | 4 | ||
| 5 | + import feign.Logger; | ||
| 6 | + | ||
| 6 | 7 | public class FeignConfig { | |
| 7 | 8 | ||
| 8 | 9 | @Bean | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -1,13 +1,15 @@ | |||
| 1 | - package com.baeldung.cloud.openfeign.controller; | ||
| 1 | + package com.baeldung.core.controller; | ||
| 2 | 2 | ||
| 3 | - import com.baeldung.cloud.openfeign.client.EmployeeClient; | ||
| 4 | - import com.baeldung.cloud.openfeign.model.Employee; | ||
| 5 | - import feign.Feign; | ||
| 6 | - import feign.form.spring.SpringFormEncoder; | ||
| 7 | 3 | import org.springframework.web.bind.annotation.GetMapping; | |
| 8 | 4 | import org.springframework.web.bind.annotation.RequestParam; | |
| 9 | 5 | import org.springframework.web.bind.annotation.RestController; | |
| 10 | 6 | ||
| 7 | + import com.baeldung.core.client.EmployeeClient; | ||
| 8 | + import com.baeldung.core.model.Employee; | ||
| 9 | + | ||
| 10 | + import feign.Feign; | ||
| 11 | + import feign.form.spring.SpringFormEncoder; | ||
| 12 | + | ||
| 11 | 13 | @RestController | |
| 12 | 14 | public class EmployeeController { | |
| 13 | 15 | ||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -1,13 +1,13 @@ | |||
| 1 | - package com.baeldung.cloud.openfeign.customizederrorhandling.client; | ||
| 2 | - | ||
| 3 | - import com.baeldung.cloud.openfeign.customizederrorhandling.config.FeignConfig; | ||
| 4 | - import com.baeldung.cloud.openfeign.defaulterrorhandling.model.Product; | ||
| 1 | + package com.baeldung.core.customizederrorhandling.client; | ||
| 5 | 2 | ||
| 6 | 3 | import org.springframework.cloud.openfeign.FeignClient; | |
| 7 | 4 | import org.springframework.web.bind.annotation.PathVariable; | |
| 8 | 5 | import org.springframework.web.bind.annotation.RequestMapping; | |
| 9 | 6 | import org.springframework.web.bind.annotation.RequestMethod; | |
| 10 | 7 | ||
| 8 | + import com.baeldung.core.customizederrorhandling.config.FeignConfig; | ||
| 9 | + import com.baeldung.core.defaulterrorhandling.model.Product; | ||
| 10 | + | ||
| 11 | 11 | @FeignClient(name = "product-client-2", url = "http://localhost:8081/product/", configuration = FeignConfig.class) | |
| 12 | 12 | public interface ProductClient { | |
| 13 | 13 | ||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -1,8 +1,9 @@ | |||
| 1 | - package com.baeldung.cloud.openfeign.customizederrorhandling.config; | ||
| 1 | + package com.baeldung.core.customizederrorhandling.config; | ||
| 2 | + | ||
| 3 | + import com.baeldung.core.customizederrorhandling.exception.ProductNotFoundException; | ||
| 4 | + import com.baeldung.core.customizederrorhandling.exception.ProductServiceNotAvailableException; | ||
| 5 | + import com.baeldung.core.exception.BadRequestException; | ||
| 2 | 6 | ||
| 3 | - import com.baeldung.cloud.openfeign.exception.BadRequestException; | ||
| 4 | - import com.baeldung.cloud.openfeign.customizederrorhandling.exception.ProductNotFoundException; | ||
| 5 | - import com.baeldung.cloud.openfeign.customizederrorhandling.exception.ProductServiceNotAvailableException; | ||
| 6 | 7 | import feign.Response; | |
| 7 | 8 | import feign.codec.ErrorDecoder; | |
| 8 | 9 | ||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -1,8 +1,9 @@ | |||
| 1 | - package com.baeldung.cloud.openfeign.customizederrorhandling.config; | ||
| 1 | + package com.baeldung.core.customizederrorhandling.config; | ||
| 2 | + | ||
| 3 | + import org.springframework.context.annotation.Bean; | ||
| 2 | 4 | ||
| 3 | 5 | import feign.Logger; | |
| 4 | 6 | import feign.codec.ErrorDecoder; | |
| 5 | - import org.springframework.context.annotation.Bean; | ||
| 6 | 7 | ||
| 7 | 8 | public class FeignConfig { | |
| 8 | 9 | ||
| Back | FazBrowse Home | New Git URL |
0 commit comments