spring-cloud / spring-cloud-openfeign

Support for using OpenFeign in Spring Cloud apps
Apache License 2.0
1.19k stars 774 forks source link

2021.0.1: FeignClient appending 'null//' in the absolute url when the base url defined in @FeignClient is just the protocol(https://) #693

Closed gokulvenugopal9 closed 2 years ago

gokulvenugopal9 commented 2 years ago

Describe the issue My current project is using- Spring Cloud version: Greenwich.RELEASE Spring Boot version: 2.2.1.RELEASE Using another project as dependency where they have defined FeignClient as:

@FeignClient(name = "MessagingClient", url = "${messaging.hypertext}", configuration = MessagingFeignClientConfig.class)
public interface MessagingAppRestClient {

    @PostMapping(value = "api.io/destinations")

In my application.properties - messaging.hypertext=https:// Feign client working expected with generating url as https://api.io/destinations

When trying to upgrade using, Spring Cloud version: 2021.0.1 Spring Boot version: 2.6.4 Feign client is populating url as https://null//api.io/destinations

Couldn't understand how 'null//' is getting appended in the absolute/final url. I have no control over the other project where feign client is defined. So let me know if there is any workaround I can do it in my project to fix this issue/make feign backward compatible with Greenwich.RELEASE.

OlgaMaciaszek commented 2 years ago

Hello @gokulvenugopal9; This is not a supported use-case. If that was working in Greenwich, it must have been more of a side-effect. The url is supposed to contain the host. What's being appended should only be the path. So, you should refactor the property like so messaging.hypertext=https://api.io and the annotation to @PostMapping(value = "/destinations")

spring-cloud-issues commented 2 years ago

If you would like us to look at this issue, please provide the requested information. If the information is not provided within the next 7 days this issue will be closed.

spring-cloud-issues commented 2 years ago

Closing due to lack of requested feedback. If you would like us to look at this issue, please provide the requested information and we will re-open the issue.