I would like to avoid hardcoding of url template in these annotations to be able to change it via configuration properties. So, I would like to be able specify configuration property in these annotations, for example:
@GetExchange("${app.api.url}")
- where app.api.url
is a configuration property key
and
@GetExchange("#{@app.api.url}")
- where app
is some bean annotated with @ConfigurationProperties
Could you please implement such thing?
Comment From: bclozel
Supporting SpEL expressions in such annotations is one thing and we can consider this.
In this case, I think the best course of action would be configure that URL as the base URI used by the HTTP client used when generating the proxy. Have you tried this approach?
Comment From: originalrusyn
In this case, I think the best course of action would be configure that URL as the base URI used by the HTTP client used when generating the proxy. Have you tried this approach?
No, I haven't because it wouldn't do what I want anyway (I would like to avoid hardcoding of any part of url template in such annotations. But in this case I still would have to specify relative part of url template in the annotation).
Comment From: rstoyanchev
These are not SpEL expressions, but property placeholders, and we already resolve these, see #28492. Make sure that you are setting embeddedValueResolver
on the HttpServiceProxyFactory
builder.
Comment From: originalrusyn
@rstoyanchev
Ok, after following change it works.
Thanks
var httpServiceProxyFactory = HttpServiceProxyFactory.builder(webClientAdapter)
.embeddedValueResolver(configurableBeanFactory::resolveEmbeddedValue)
.build();
(Now It would be nice that Intelij IDEA to support property placeholders in these annotations)