@DefaultValue is not compatible with @PathParameter in RESTful framework
I got a requirement that I need a default value for @PathParameter
.
And this is what my code looks like:
@GET
@Path("/family/{member}")
public Response responseMsg( @DefaultValue("Father") @PathParam("member") String pathParameter) {}
The compiler will not show any errors, and the application will of course not act as I expected.
because uri "/ family / null
" will not match the path " /family/{member}
" but " /family/
"
May I know if there is a way to assign a default value to @PathParam
and how? and also i want to know if compatible @DefaultValue
with @QueryParameter
?
source to share