I am trying to resolve a Spring placeholder on a Feign interface using jaxrs contract :
@FeignClient(value = "myClient"
, url = "${server.url}"
, configuration = MyFeignConf.class)
public interface MyClient {
@GET
@Path("${server.querypath}")
@Produces("application/json")
JsonNode olaTvQuery(@QueryParam("nbResults") int nbResults)
}
But found out that only server.url
was resolved by SpringBoot's placeholder filling mechanism. ${server.querypath}
is not resolved and is given to GET
as a literal value.
Anyone doing that ? Should I open a feature request ? Thanks for your answers.
Since the annotation is mapping an URL to the method it has a certain syntax to allow for functionality like referencing path variables. For example:
@Path("/user/{id}")
public Response getUser(@PathParam("id") int userId) {
// ...
}
And since the $
character is allowed to be present in an URL, Jersey(JAX-RS) is actually looking at what your wrote like @Path("<some path that happens to contain a $>{and a path variable goes here}")
and this is where things would get ambiguous and very hard to keep track of, so spring doesn't interfere with the mapping string.