Common Configuration (Logging, Persistence, Retry, etc.)
<dependency>
<groupId>io.github.requestlog</groupId>
<artifactId>request-log-feign-starter</artifactId>
<version>${last stable version}</version>
</dependency>
Feign adopts an AOP approach and is automatically enhanced after introducing the dependency.
If you want to temporarily disable it, configure request-log.feign.disable=true
.
Note: FeignClient must use service discovery. If a URL is specified, it will not be intercepted by AOP.
import io.github.requestlog.feign.clients.TestFeignClient; // Feign for testing, can be found in the test package
// Original Request
ResponseModel responseModel = testFeignClient.get();
// Wrap the request using LogContext
ResponseModel responseModel = LogContext.log().execute(() -> {
return testFeignClient.get();
});
Feign retry is not supported; you can use other HttpClient retry mechanisms
If rewriting request information is involved during retry, refer to Common Usage - Retry