JAX-RS PUT 方法。 @Consumes 注释声明的输入媒体如何注入到方法的参数中?

JAX-RS PUT method. How does the input media declared by the @Consumes annotation get injected in the method's parameter?

我在我的资源中声明了以下方法 class。

@Path("{id:\d+}")
@PUT
@Consumes({MediaType.APPLICATION_JSON, MediaType.APPLICATION_XML})
public Response putPerson(@PathParam("id") long id, Person person) {
    logger.debug("Going to update the person with id: {} to name {} age {} and salary {}", id, person.getName(), person.getAge(), person.getSalary());
    db.put(id, person);
    return Response.noContent().build();
}

据我了解,由于 @PathParam 注释,我的 {id} 路径值确实被注入到 id 参数中。但是我很好奇@Consumes 注释声明的输入媒体是如何注入到 person 参数中的? 我想知道,因为没有声明注释来将任何值注入到 person 参数中。

我知道媒体确实被注入了,因为我的记录器语句确实打印了正确的值。

Jersey 用户手册或任何 JavaDoc 中是否记录了此注入过程?

我确实在 section 7.1 的 2.31 版 Jersey 用户指南中找到了答案。内容如下。

Unlike method parameters that are associated with the extraction of request parameters, the method parameter associated with the representation being consumed does not require annotating. In other words the representation (entity) parameter does not require a specific 'entity' annotation. A method parameter without an annotation is an entity. A maximum of one such unannotated method parameter may exist since there may only be a maximum of one such representation sent in a request.