Reading FeignClient url from application.yaml not working

720 Views Asked by At

I am trying to read the Feign client url from application.yaml, I am not using ribbon. Ribbon worked before now I migrated to spring boot 3.1.4 and spring cloud 2022.0.3

@FeignClient(name = "new-common-service", url = "${spring.cloud.openfeign.client.config.new-common-service.url}")
public interface NewCommonServiceClient {
@GetMapping(value = "/test")
ResponseEntity<?> testRequest();

}

In application yaml

cloud:
    openfeign:
      client:
        config:
          new-common-service:
          url: localhost:9090/serve

It is showing error

java.lang.IllegalArgumentException: http://${cloud.openfeign.client.config.new-common-service.url} is malformed Caused by: java.net.MalformedURLException: Illegal character found in host: '{'

how to fix this issue

I expect FeignClient url value to be read from the application yaml file

0

There are 0 best solutions below