#1521 - Allow HATEOAS bootstrap without any default media type enabled.
@EnableHypermediaSupport(types = {}) was not working anymore as the Comparator implementation working with the selected types rejected an empty list. We now do not reject that anymore to enable applications that solely work with third party media types.
This commit is contained in:
@@ -40,7 +40,7 @@ class HypermediaMappingInformationComparator implements Comparator<HypermediaMap
|
||||
*/
|
||||
HypermediaMappingInformationComparator(List<MediaType> mediaTypes) {
|
||||
|
||||
Assert.notEmpty(mediaTypes, "MediaTypes must not be empty!");
|
||||
Assert.notNull(mediaTypes, "MediaTypes must not be null!");
|
||||
|
||||
this.mediaTypes = mediaTypes;
|
||||
}
|
||||
|
||||
@@ -351,13 +351,7 @@ class EnableHypermediaSupportIntegrationTest {
|
||||
* RepresentationModel -> uber, application/json, application/*+json
|
||||
*
|
||||
* hal-forms, uber, application/json, application/*+json
|
||||
*
|
||||
*
|
||||
*
|
||||
*
|
||||
*
|
||||
*/
|
||||
|
||||
@Test
|
||||
void ordersMediaTypeIntegrationBasedOnConfiguration() {
|
||||
|
||||
@@ -370,6 +364,14 @@ class EnableHypermediaSupportIntegrationTest {
|
||||
});
|
||||
}
|
||||
|
||||
@Test // #1521
|
||||
void bootstrapsWithOutDefaultMediaTypeEnabled() {
|
||||
|
||||
assertThatNoException().isThrownBy(() -> {
|
||||
withServletContext(NoDefaultMediaTypes.class, context -> {});
|
||||
});
|
||||
}
|
||||
|
||||
private static void assertEntityLinksSetUp(ApplicationContext context) {
|
||||
|
||||
assertThat(context.getBeansOfType(EntityLinks.class).values()) //
|
||||
@@ -588,4 +590,8 @@ class EnableHypermediaSupportIntegrationTest {
|
||||
static class MediaTypeOrdering {
|
||||
|
||||
}
|
||||
|
||||
@Configuration
|
||||
@EnableHypermediaSupport(type = {})
|
||||
static class NoDefaultMediaTypes {}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user