user35202
user35202

Reputation: 419

jaxrs variable @Path

I have a method annotated with jax-rs like this

@POST
@Path("/somepath")
public Response testPost(...)

I would like to use instead of "/somepath" a java string constant (retrieved from configuration). Is that possible?

I know that I can do @Path({somepath}) and then use @PathParam to replace it but that's a different use case where the caller passes a dynamic param.

Upvotes: 1

Views: 1034

Answers (1)

tonio
tonio

Reputation: 10541

In java, annotation parameters must be compile-time constants. Thus, you will not be able to use configuration retrieved values in the @Path annotation.

Upvotes: 2

Related Questions