I'm trying to inject a property from my application.properties as a baseUri in my ServiceClient. This is my ServiceClient:
@Path("/products/v2")
@Produces(MediaType.APPLICATION_JSON)
@RegisterRestClient(baseUri = "url...")
public interface ProductServiceClient {
@GET
@Path("/search")
String searchProducts();
}
What I've tried:
I can't use @ConfigProperty as noted here: https://quarkus.io/guides/config#using-configproperties, because Java tells me the types are incompatible:
@RegisterRestClient(baseUri = @ConfigProperty(name = "base.url"))
"Incompatible types. Found: 'org.eclipse.microprofile.config.inject.ConfigProperty', required: 'java.lang.String'"
I've also tried to programattically access the property as said here: https://quarkus.io/guides/config#programmatically-access-the-configuration
@RegisterRestClient(baseUri = ConfigProvider.getConfig().getValue("base.url", String.class))
This doesn't work because Java tells me that the "Attribute value must be constant".
I've also tried this which didn't work for me either: Quarkus & Microprofile : Is there a better way to use a property from application.properties into @ClientHeaderParam?
How can I inject a property from my application.properties/application.yaml file as a baseUri in @RegisterRestClient?