我有以下代码INTERFACE使用应用程序xml
@Path("/user")
public interface UserService {
@CONSUMES(MediaType.APPLICATION_XML)
@POST
@Path("/{userId}")
public Response creaTeUser(@PathParam("userId") Long userId);
}
I have implementation which consume application JSON
class UserServiceImpl implements UserService {
@Override
@POST
@Path("/{userId}")
@CONSUMES(MediaType.APPLICATION_JSON)
public Response getUser(@PathParam("userId") Long userId) {
// TODO Auto-generated method stub
return null;
}
}
当我发布用户实际媒体类型时
答案 0 :(得分:0)
Java方法注释不支持继承,因此您的媒体类型将为application/json
。请参阅此答案:Why java classes do not inherit annotations from implemented interfaces?