diff --git a/spring-data-rest-webmvc/src/main/java/org/springframework/data/rest/webmvc/RepositoryRestHandlerMapping.java b/spring-data-rest-webmvc/src/main/java/org/springframework/data/rest/webmvc/RepositoryRestHandlerMapping.java index b40d759d1..dadeed048 100644 --- a/spring-data-rest-webmvc/src/main/java/org/springframework/data/rest/webmvc/RepositoryRestHandlerMapping.java +++ b/spring-data-rest-webmvc/src/main/java/org/springframework/data/rest/webmvc/RepositoryRestHandlerMapping.java @@ -189,6 +189,8 @@ public class RepositoryRestHandlerMapping extends BasePathAwareHandlerMapping { Set mediaTypes = new LinkedHashSet(); mediaTypes.add(configuration.getDefaultMediaType().toString()); + mediaTypes.add(MediaTypes.HAL_JSON_VALUE); + mediaTypes.add(MediaTypes.VND_HAL_JSON_VALUE); mediaTypes.add(MediaType.APPLICATION_JSON_VALUE); mediaTypes.add(MediaTypes.HAL_FORMS_JSON_VALUE); diff --git a/spring-data-rest-webmvc/src/main/java/org/springframework/data/rest/webmvc/config/RepositoryRestMvcConfiguration.java b/spring-data-rest-webmvc/src/main/java/org/springframework/data/rest/webmvc/config/RepositoryRestMvcConfiguration.java index f16a5dcbf..7496522dc 100644 --- a/spring-data-rest-webmvc/src/main/java/org/springframework/data/rest/webmvc/config/RepositoryRestMvcConfiguration.java +++ b/spring-data-rest-webmvc/src/main/java/org/springframework/data/rest/webmvc/config/RepositoryRestMvcConfiguration.java @@ -575,6 +575,7 @@ public class RepositoryRestMvcConfiguration extends HateoasAwareSpringDataWebCon ArrayList mediaTypes = new ArrayList<>(); mediaTypes.add(MediaTypes.HAL_JSON); + mediaTypes.add(MediaTypes.VND_HAL_JSON); // Enable returning HAL if application/json is asked if it's configured to be the default type if (repositoryRestConfiguration.useHalAsDefaultJsonMediaType()) { @@ -809,7 +810,8 @@ public class RepositoryRestMvcConfiguration extends HateoasAwareSpringDataWebCon messageConverters.add(alpsJsonHttpMessageConverter); } - if (repositoryRestConfiguration.getDefaultMediaType().equals(MediaTypes.HAL_JSON)) { + if (List.of(MediaTypes.HAL_JSON, MediaTypes.VND_HAL_JSON) + .contains(repositoryRestConfiguration.getDefaultMediaType())) { messageConverters.add(halJacksonHttpMessageConverter); messageConverters.add(jacksonHttpMessageConverter); } else {