With the removal of support for Apache HttpClient 4 in the recent commit (d30540d), the Spring Cloud OpenFeign project has transitioned to using Apache HttpClient 5 for its HTTP client functionality. As a result, an Apache HttpClient 5 client bean is now automatically generated when the class ApacheHttp5Client.class is present on the classpath. This enhancement was achieved by introducing matchIfMissing = true on the property condition, for example here.

To maintain alignment between the codebase and documentation, changes have to be done in the documentation files: spring-cloud-openfeign.adoc and additional-spring-configuration-metadata.json.

It's important to note that, as of this update, only the Apache HttpClient 5 client is automatically enabled if the necessary class is detected on the classpath. The other two clients, Http2Client and OkHttpClient, require explicit configuration for enabling. It might be beneficial to review the usage of matchIfMissing = true for the spring.cloud.openfeign.httpclient.hc5.enabled property condition to ensure consistency.

Furthermore, we've identified inconsistent behavior related to the other two clients. Instances such as this and this indicate that property values do not necessarily have to be set to true to satisfy the associated conditions.

This observation encourages us to review and potentially revise the usage of matchIfMissing = true across various property conditions, ensuring a cohesive and intuitive configuration experience.

Thank you for considering these suggestions and improvements.

Comment From: OlgaMaciaszek

Hello @ernest-gonzales, thanks for reporting the issue and the thorough analysis and description. I will fix the docs. When it comes to the inconsistency between enabling the different modes, you're right, but since the Spring Cloud OpenFeign is now in maintenance mode, we will not be adding this to the backlog.

When it comes to this bit:

Furthermore, we've identified inconsistent behavior related to the other two clients. Instances such as this and this indicate that property values do not necessarily have to be set to true to satisfy the associated conditions.

I'm not sure I understand what you mean. Could you please provide more details in a separate issue?

Comment From: OlgaMaciaszek

@ernest-gonzales , I'm going to work on the documentation fix within this issue. Please create another issue with more details for the problem quoted in my comment above.

Comment From: ernest-gonzales

Hi @OlgaMaciaszek , thank you for your changes to the documentation. I'm sure this will help everyone using OpenFeign in their projects.

Furthermore, we've identified inconsistent behavior related to the other two clients. Instances such as this and this indicate that property values do not necessarily have to be set to true to satisfy the associated conditions.

What I mean is that @ConditionalOnProperty("spring.cloud.openfeign.okhttp.enabled") will be evaluated to true for any value different from an empty string and "false", e.g. values like "dummy" or "never" will enable annotated classes. Please check Spring documentation for details. I believe it would be better to change conditions I pointed out to @ConditionalOnProperty(name = "spring.cloud.openfeign.okhttp.enabled", havingValue="true")

Comment From: OlgaMaciaszek

That's right. However, something that could only be changed during a major release to maintain compatibility. At this point, the next major release has not been scheduled.

Comment From: OlgaMaciaszek

See new issue: https://github.com/spring-cloud/spring-cloud-openfeign/issues/956

Comment From: ernest-gonzales

See new issue: #956

Great, thank you!