A Digital Life

My Notebook

View My GitHub Profile

  • About
  • 17 August 2022

    Feign Exception Invalid HTTP method PATCH

    by kerner1000

    Tell Feign to use Apache’s HTTP client:

    public class FeignConfiguration {
    
        @Bean
        Client apacheHttpClient(ApacheHttpClientConfigurationProperties properties) {
            CloseableHttpClient apacheClient = HttpClients.custom()
                    .setMaxConnTotal(properties.getMaxConnectionsTotal())
                    .setMaxConnPerRoute(properties.getMaxConnectionsPerRoute())
                    .build();
            return new ApacheHttpClient(apacheClient);
        }
    }
    
    <dependency>
      <groupId>org.springframework.cloud</groupId>
      <artifactId>spring-cloud-starter-openfeign</artifactId>
      <exclusions>
        <exclusion>
          <groupId>io.github.openfeign</groupId>
          <artifactId>feign-core</artifactId>
        </exclusion>
      </exclusions>
    </dependency>
    <dependency>
      <groupId>io.github.openfeign</groupId>
      <artifactId>feign-core</artifactId>
    </dependency>
    <dependency>
      <groupId>io.github.openfeign</groupId>
      <artifactId>feign-httpclient</artifactId>
    </dependency>
    
    apache:
      http:
        client:
          max-connections-per-route: 20
          max-connections-total: 200
    
    tags: java - spring-boot - feign