To quote javadoc , MediaType.APPLICATION_JSON is the "public media type for application/json ", while MediaType.APPLICATION_JSON_VALUE a "String equivalent of MediaType.APPLICATION_JSON ".
Java annotation attributes can only be one of a limited set of types. This prevents using MediaType as an annotation attribute. To overcome this, String constants on MediaType are used instead of String , including MediaType.APPLICATION_JSON_VALUE .
Outside of the annotation, if you want to refer to the type of media file, you should use a more strongly typed MediaType , rather than passing around a String , which may or may not actually be a media type. So, for example, you would use MediaType.APPLICATION_JSON , not MediaType.APPLICATION_JSON_VALUE .
source share