0

I would like to set @ClientHeaderParam's value with @ConfigProperty like below;

  @ClientHeaderParam(name = "Authorization", value = @ConfigProperty("auth.key"))

However it says:

Incompatible types. Found: 'org.eclipse.microprofile.config.inject.ConfigProperty', required: 'java.lang.String[]'

is there a way to set value with @ConfigProperty like above?

Thanks.

Chin Huang
  • 12,912
  • 4
  • 46
  • 47
Aksoy
  • 91
  • 1
  • 8

1 Answers1

1

You can use default method in your rest-client interface and programatic access to configuration :

default String authKey() {
 return ConfigProvider.getConfig().getValue("auth.key", String.class);
}

and in your annotation :

@ClientHeaderParam(name = "Authorization", value = "Bearer {authKey}")
iabughosh
  • 481
  • 5
  • 19