In Quarkus, I am able to define the base url for my clients in my YAML file via the /mp-rest/url property. Currently my YAML file looks like this:
...
"%dev":
some:
package:
name:
client:
ExampleService1/mp-rest/url: https://some.url.com
ExampleService2/mp-rest/url: https://some.url.com
"%tst":
some:
package:
name:
client:
ExampleService1/mp-rest/url: https://some.other.url.com
ExampleService2/mp-rest/url: https://some.other.url.com
...
As you can see I have multiple services which all have the same base url in their respective development environments (all dev base urls are the same, and all tst base urls are the same).
As I have the same base url for each environment's services, I don't want to have to define the url for each service I have.
My Question: Is there a way for me to define the /mp-rest/url for ALL services in my client folder at once? It would have to look something like this (obviously this doesn't work):
"%dev":
some:
package:
name:
client:
*/mp-rest/url: https://some.url.com
"%tst":
some:
package:
name:
client:
*/mp-rest/url: https://some.other.url.com
You can define a single configuration that you can use in all your REST Client.
First, define the configuration with a custom name instead of the default package + class name:
country-api/mp-rest/url=https://restcountries.eu/rest
Then tell the REST client to use this custom configuration instead of the default one :
@RegisterRestClient(configKey="country-api")
public interface CountriesService {
[...]
}
You can find more information here: https://quarkus.io/guides/rest-client#create-the-configuration
EDIT : for application.yml something like this should works
country-api/mp-rest/url: https://restcountries.eu/rest
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With