From d714d1067559960016a72e6d3399a86e82d6bd57 Mon Sep 17 00:00:00 2001 From: Oliver Drotbohm Date: Mon, 4 Mar 2019 11:42:58 +0100 Subject: [PATCH] DATAREST-1341 - Upgrade to latest API changes in Spring HATEOAS. --- .../core/config/RepositoryRestConfiguration.java | 12 ++++++------ ...nflectorTypeBasedCollectionResourceMapping.java | 4 ++-- .../RepositoryCollectionResourceMapping.java | 10 +++++----- .../core/mapping/RepositoryResourceMappings.java | 4 ++-- .../TypeBasedCollectionResourceMapping.java | 12 ++++++------ .../rest/core/support/RepositoryRelProvider.java | 8 ++++---- .../data/rest/core/support/SimpleRelProvider.java | 8 ++++---- .../rest/core/config/ResourceMappingUnitTests.java | 6 +++--- .../data/rest/tests/RepositoryTestsConfig.java | 10 +++++----- .../data/rest/webmvc/jpa/JpaWebTests.java | 4 ++-- .../rest/webmvc/json/RepositoryTestsConfig.java | 10 +++++----- .../config/RepositoryRestMvcConfiguration.java | 14 +++++++------- ...ositoryRestMvConfigurationIntegrationTests.java | 8 ++++---- .../json/ProjectionJacksonIntegrationTests.java | 12 ++++++------ 14 files changed, 61 insertions(+), 61 deletions(-) diff --git a/spring-data-rest-core/src/main/java/org/springframework/data/rest/core/config/RepositoryRestConfiguration.java b/spring-data-rest-core/src/main/java/org/springframework/data/rest/core/config/RepositoryRestConfiguration.java index ceb5696e1..3edf5cfb7 100644 --- a/spring-data-rest-core/src/main/java/org/springframework/data/rest/core/config/RepositoryRestConfiguration.java +++ b/spring-data-rest-core/src/main/java/org/springframework/data/rest/core/config/RepositoryRestConfiguration.java @@ -32,8 +32,8 @@ import org.springframework.data.rest.core.mapping.RepositoryDetectionStrategy; import org.springframework.data.rest.core.mapping.RepositoryDetectionStrategy.RepositoryDetectionStrategies; import org.springframework.data.rest.core.support.EntityLookup; import org.springframework.hateoas.MediaTypes; -import org.springframework.hateoas.server.RelProvider; -import org.springframework.hateoas.server.core.EvoInflectorRelProvider; +import org.springframework.hateoas.server.LinkRelationProvider; +import org.springframework.hateoas.server.core.EvoInflectorLinkRelationProvider; import org.springframework.http.MediaType; import org.springframework.util.Assert; import org.springframework.util.StringUtils; @@ -73,7 +73,7 @@ public class RepositoryRestConfiguration { /** * The {@link RelProvider} to be used to calculate the link relation defaults for repositories. */ - private @Getter @Setter @NonNull RelProvider relProvider = new EvoInflectorRelProvider(); + private @Getter @Setter @NonNull LinkRelationProvider relProvider = new EvoInflectorLinkRelationProvider(); private final RepositoryCorsRegistry corsRegistry = new RepositoryCorsRegistry(); private final ProjectionDefinitionConfiguration projectionConfiguration; @@ -579,7 +579,7 @@ public class RepositoryRestConfiguration { /** * Returns whether to expose repository methods by default. - * + * * @since 3.1 * @see #setExposeRepositoryMethodsByDefault(boolean) */ @@ -592,7 +592,7 @@ public class RepositoryRestConfiguration { * {@link RestResource} explicitly to expose the default set of resources (opt-in). If this is set to {@literal true} * (default), repository methods methods are exposed unless explictly annotated with {@link RestResource} and * {@link RestResource#exported()} set to {@literal false}. - * + * * @since 3.1 * @see #setRepositoryDetectionStrategy(RepositoryDetectionStrategy) */ @@ -607,7 +607,7 @@ public class RepositoryRestConfiguration { * {@link #setRepositoryDetectionStrategy(RepositoryDetectionStrategy)} to * {@link RepositoryDetectionStrategies#ANNOTATED} and setting {@link #setExposeRepositoryMethodsByDefault(boolean)} * to {@literal false}. - * + * * @since 3.1 * @see #setRepositoryDetectionStrategy(RepositoryDetectionStrategy) * @see #setExposeRepositoryMethodsByDefault(boolean) diff --git a/spring-data-rest-core/src/main/java/org/springframework/data/rest/core/mapping/EvoInflectorTypeBasedCollectionResourceMapping.java b/spring-data-rest-core/src/main/java/org/springframework/data/rest/core/mapping/EvoInflectorTypeBasedCollectionResourceMapping.java index 80f04cdb9..fb09a6940 100644 --- a/spring-data-rest-core/src/main/java/org/springframework/data/rest/core/mapping/EvoInflectorTypeBasedCollectionResourceMapping.java +++ b/spring-data-rest-core/src/main/java/org/springframework/data/rest/core/mapping/EvoInflectorTypeBasedCollectionResourceMapping.java @@ -16,7 +16,7 @@ package org.springframework.data.rest.core.mapping; import org.atteo.evo.inflector.English; -import org.springframework.hateoas.server.RelProvider; +import org.springframework.hateoas.server.LinkRelationProvider; /** * {@link TypeBasedCollectionResourceMapping} extension to use Evo Inflector to pluralize the simple class name by as @@ -32,7 +32,7 @@ class EvoInflectorTypeBasedCollectionResourceMapping extends TypeBasedCollection * @param type must not be {@literal null}. * @param relProvider must not be {@literal null}. */ - public EvoInflectorTypeBasedCollectionResourceMapping(Class type, RelProvider relProvider) { + public EvoInflectorTypeBasedCollectionResourceMapping(Class type, LinkRelationProvider relProvider) { super(type, relProvider); } diff --git a/spring-data-rest-core/src/main/java/org/springframework/data/rest/core/mapping/RepositoryCollectionResourceMapping.java b/spring-data-rest-core/src/main/java/org/springframework/data/rest/core/mapping/RepositoryCollectionResourceMapping.java index 4c7a39391..6df803805 100644 --- a/spring-data-rest-core/src/main/java/org/springframework/data/rest/core/mapping/RepositoryCollectionResourceMapping.java +++ b/spring-data-rest-core/src/main/java/org/springframework/data/rest/core/mapping/RepositoryCollectionResourceMapping.java @@ -23,8 +23,8 @@ import org.springframework.data.rest.core.Path; import org.springframework.data.rest.core.annotation.RepositoryRestResource; import org.springframework.data.rest.core.annotation.RestResource; import org.springframework.hateoas.LinkRelation; -import org.springframework.hateoas.server.RelProvider; -import org.springframework.hateoas.server.core.EvoInflectorRelProvider; +import org.springframework.hateoas.server.LinkRelationProvider; +import org.springframework.hateoas.server.core.EvoInflectorLinkRelationProvider; import org.springframework.util.Assert; import org.springframework.util.ClassUtils; import org.springframework.util.StringUtils; @@ -48,7 +48,7 @@ class RepositoryCollectionResourceMapping implements CollectionResourceMapping { private final RepositoryMetadata metadata; public RepositoryCollectionResourceMapping(RepositoryMetadata metadata, RepositoryDetectionStrategy strategy) { - this(metadata, strategy, new EvoInflectorRelProvider()); + this(metadata, strategy, new EvoInflectorLinkRelationProvider()); } /** @@ -60,10 +60,10 @@ class RepositoryCollectionResourceMapping implements CollectionResourceMapping { * @param repositoryType must not be {@literal null}. */ RepositoryCollectionResourceMapping(RepositoryMetadata metadata, RepositoryDetectionStrategy strategy, - RelProvider relProvider) { + LinkRelationProvider relProvider) { Assert.notNull(metadata, "Repository metadata must not be null!"); - Assert.notNull(relProvider, "RelProvider must not be null!"); + Assert.notNull(relProvider, "LinkRelationProvider must not be null!"); Assert.notNull(strategy, "RepositoryDetectionStrategy must not be null!"); Class repositoryType = metadata.getRepositoryInterface(); diff --git a/spring-data-rest-core/src/main/java/org/springframework/data/rest/core/mapping/RepositoryResourceMappings.java b/spring-data-rest-core/src/main/java/org/springframework/data/rest/core/mapping/RepositoryResourceMappings.java index 066bf0174..9174b6464 100644 --- a/spring-data-rest-core/src/main/java/org/springframework/data/rest/core/mapping/RepositoryResourceMappings.java +++ b/spring-data-rest-core/src/main/java/org/springframework/data/rest/core/mapping/RepositoryResourceMappings.java @@ -28,7 +28,7 @@ import org.springframework.data.repository.core.RepositoryInformation; import org.springframework.data.repository.support.Repositories; import org.springframework.data.rest.core.annotation.RestResource; import org.springframework.data.rest.core.config.RepositoryRestConfiguration; -import org.springframework.hateoas.server.RelProvider; +import org.springframework.hateoas.server.LinkRelationProvider; import org.springframework.util.Assert; /** @@ -74,7 +74,7 @@ public class RepositoryResourceMappings extends PersistentEntitiesResourceMappin PersistentEntity entity = repositories.getPersistentEntity(type); RepositoryDetectionStrategy strategy = configuration.getRepositoryDetectionStrategy(); - RelProvider provider = configuration.getRelProvider(); + LinkRelationProvider provider = configuration.getRelProvider(); CollectionResourceMapping mapping = new RepositoryCollectionResourceMapping(repositoryInformation, strategy, provider); diff --git a/spring-data-rest-core/src/main/java/org/springframework/data/rest/core/mapping/TypeBasedCollectionResourceMapping.java b/spring-data-rest-core/src/main/java/org/springframework/data/rest/core/mapping/TypeBasedCollectionResourceMapping.java index 20b9946f7..af6bc7ca7 100644 --- a/spring-data-rest-core/src/main/java/org/springframework/data/rest/core/mapping/TypeBasedCollectionResourceMapping.java +++ b/spring-data-rest-core/src/main/java/org/springframework/data/rest/core/mapping/TypeBasedCollectionResourceMapping.java @@ -22,8 +22,8 @@ import org.springframework.data.rest.core.Path; import org.springframework.data.rest.core.annotation.Description; import org.springframework.data.rest.core.annotation.RestResource; import org.springframework.hateoas.LinkRelation; -import org.springframework.hateoas.server.RelProvider; -import org.springframework.hateoas.server.core.EvoInflectorRelProvider; +import org.springframework.hateoas.server.LinkRelationProvider; +import org.springframework.hateoas.server.core.EvoInflectorLinkRelationProvider; import org.springframework.util.Assert; import org.springframework.util.StringUtils; @@ -36,7 +36,7 @@ import org.springframework.util.StringUtils; class TypeBasedCollectionResourceMapping implements CollectionResourceMapping { private final Class type; - private final RelProvider relProvider; + private final LinkRelationProvider relProvider; private final RestResource annotation; private final Description description; @@ -46,7 +46,7 @@ class TypeBasedCollectionResourceMapping implements CollectionResourceMapping { * @param type must not be {@literal null}. */ public TypeBasedCollectionResourceMapping(Class type) { - this(type, new EvoInflectorRelProvider()); + this(type, new EvoInflectorLinkRelationProvider()); } /** @@ -55,10 +55,10 @@ class TypeBasedCollectionResourceMapping implements CollectionResourceMapping { * @param type must not be {@literal null}. * @param relProvider must not be {@literal null}. */ - public TypeBasedCollectionResourceMapping(Class type, RelProvider relProvider) { + public TypeBasedCollectionResourceMapping(Class type, LinkRelationProvider relProvider) { Assert.notNull(type, "Type must not be null!"); - Assert.notNull(relProvider, "RelProvider must not be null!"); + Assert.notNull(relProvider, "LinkRelationProvider must not be null!"); this.type = type; this.relProvider = relProvider; diff --git a/spring-data-rest-core/src/main/java/org/springframework/data/rest/core/support/RepositoryRelProvider.java b/spring-data-rest-core/src/main/java/org/springframework/data/rest/core/support/RepositoryRelProvider.java index ccb2d3e23..322a7078b 100644 --- a/spring-data-rest-core/src/main/java/org/springframework/data/rest/core/support/RepositoryRelProvider.java +++ b/spring-data-rest-core/src/main/java/org/springframework/data/rest/core/support/RepositoryRelProvider.java @@ -20,7 +20,7 @@ import org.springframework.core.Ordered; import org.springframework.core.annotation.Order; import org.springframework.data.rest.core.mapping.ResourceMappings; import org.springframework.hateoas.LinkRelation; -import org.springframework.hateoas.server.RelProvider; +import org.springframework.hateoas.server.LinkRelationProvider; import org.springframework.util.Assert; /** @@ -29,7 +29,7 @@ import org.springframework.util.Assert; * @author Oliver Gierke */ @Order(Ordered.LOWEST_PRECEDENCE + 10) -public class RepositoryRelProvider implements RelProvider { +public class RepositoryRelProvider implements LinkRelationProvider { private final ObjectFactory mappings; @@ -46,7 +46,7 @@ public class RepositoryRelProvider implements RelProvider { /* * (non-Javadoc) - * @see org.springframework.hateoas.server.RelProvider#getCollectionResourceRelFor(java.lang.Class) + * @see org.springframework.hateoas.server.LinkRelationProvider#getCollectionResourceRelFor(java.lang.Class) */ @Override public LinkRelation getCollectionResourceRelFor(Class type) { @@ -55,7 +55,7 @@ public class RepositoryRelProvider implements RelProvider { /* * (non-Javadoc) - * @see org.springframework.hateoas.server.RelProvider#getItemResourceRelFor(java.lang.Class) + * @see org.springframework.hateoas.server.LinkRelationProvider#getItemResourceRelFor(java.lang.Class) */ @Override public LinkRelation getItemResourceRelFor(Class type) { diff --git a/spring-data-rest-core/src/main/java/org/springframework/data/rest/core/support/SimpleRelProvider.java b/spring-data-rest-core/src/main/java/org/springframework/data/rest/core/support/SimpleRelProvider.java index 77d6200b6..eb984fee4 100644 --- a/spring-data-rest-core/src/main/java/org/springframework/data/rest/core/support/SimpleRelProvider.java +++ b/spring-data-rest-core/src/main/java/org/springframework/data/rest/core/support/SimpleRelProvider.java @@ -16,13 +16,13 @@ package org.springframework.data.rest.core.support; import org.springframework.hateoas.LinkRelation; -import org.springframework.hateoas.server.RelProvider; +import org.springframework.hateoas.server.LinkRelationProvider; import org.springframework.util.StringUtils; /** * @author Oliver Gierke */ -public class SimpleRelProvider implements RelProvider { +public class SimpleRelProvider implements LinkRelationProvider { /* * (non-Javadoc) @@ -35,7 +35,7 @@ public class SimpleRelProvider implements RelProvider { /* * (non-Javadoc) - * @see org.springframework.hateoas.server.RelProvider#getItemResourceRelFor(java.lang.Class) + * @see org.springframework.hateoas.server.LinkRelationProvider#getItemResourceRelFor(java.lang.Class) */ @Override public LinkRelation getItemResourceRelFor(Class type) { @@ -46,7 +46,7 @@ public class SimpleRelProvider implements RelProvider { /* * (non-Javadoc) - * @see org.springframework.hateoas.server.RelProvider#getCollectionResourceRelFor(java.lang.Class) + * @see org.springframework.hateoas.server.LinkRelationProvider#getCollectionResourceRelFor(java.lang.Class) */ @Override public LinkRelation getCollectionResourceRelFor(Class type) { diff --git a/spring-data-rest-core/src/test/java/org/springframework/data/rest/core/config/ResourceMappingUnitTests.java b/spring-data-rest-core/src/test/java/org/springframework/data/rest/core/config/ResourceMappingUnitTests.java index a0d615745..e18ab5913 100755 --- a/spring-data-rest-core/src/test/java/org/springframework/data/rest/core/config/ResourceMappingUnitTests.java +++ b/spring-data-rest-core/src/test/java/org/springframework/data/rest/core/config/ResourceMappingUnitTests.java @@ -27,8 +27,8 @@ import org.springframework.data.repository.query.Param; import org.springframework.data.rest.core.annotation.RestResource; import org.springframework.data.rest.core.domain.Person; import org.springframework.data.rest.core.mapping.ResourceMapping; -import org.springframework.hateoas.server.RelProvider; -import org.springframework.hateoas.server.core.EvoInflectorRelProvider; +import org.springframework.hateoas.server.LinkRelationProvider; +import org.springframework.hateoas.server.core.EvoInflectorLinkRelationProvider; /** * Ensure the {@link ResourceMapping} components convey the correct information. @@ -38,7 +38,7 @@ import org.springframework.hateoas.server.core.EvoInflectorRelProvider; @SuppressWarnings("deprecation") public class ResourceMappingUnitTests { - RelProvider relProvider = new EvoInflectorRelProvider(); + LinkRelationProvider relProvider = new EvoInflectorLinkRelationProvider(); @Test public void shouldDetectPathAndRemoveLeadingSlashIfAny() { diff --git a/spring-data-rest-tests/spring-data-rest-tests-core/src/test/java/org/springframework/data/rest/tests/RepositoryTestsConfig.java b/spring-data-rest-tests/spring-data-rest-tests-core/src/test/java/org/springframework/data/rest/tests/RepositoryTestsConfig.java index bf796af86..447f45490 100644 --- a/spring-data-rest-tests/spring-data-rest-tests-core/src/test/java/org/springframework/data/rest/tests/RepositoryTestsConfig.java +++ b/spring-data-rest-tests/spring-data-rest-tests-core/src/test/java/org/springframework/data/rest/tests/RepositoryTestsConfig.java @@ -49,11 +49,11 @@ import org.springframework.data.rest.webmvc.support.PagingAndSortingTemplateVari import org.springframework.data.rest.webmvc.support.RepositoryEntityLinks; import org.springframework.format.support.DefaultFormattingConversionService; import org.springframework.format.support.FormattingConversionService; -import org.springframework.hateoas.server.EntityLinks; -import org.springframework.hateoas.server.RelProvider; -import org.springframework.hateoas.server.RepresentationModelProcessor; -import org.springframework.hateoas.server.core.EvoInflectorRelProvider; import org.springframework.hateoas.mediatype.hal.Jackson2HalModule; +import org.springframework.hateoas.server.EntityLinks; +import org.springframework.hateoas.server.LinkRelationProvider; +import org.springframework.hateoas.server.RepresentationModelProcessor; +import org.springframework.hateoas.server.core.EvoInflectorLinkRelationProvider; import org.springframework.hateoas.server.mvc.RepresentationModelProcessorInvoker; import org.springframework.plugin.core.PluginRegistry; @@ -128,7 +128,7 @@ public class RepositoryTestsConfig { @Bean public ObjectMapper objectMapper() { - RelProvider relProvider = new EvoInflectorRelProvider(); + LinkRelationProvider relProvider = new EvoInflectorLinkRelationProvider(); ObjectMapper mapper = new ObjectMapper(); mapper.registerModule(new Jackson2HalModule()); diff --git a/spring-data-rest-tests/spring-data-rest-tests-jpa/src/test/java/org/springframework/data/rest/webmvc/jpa/JpaWebTests.java b/spring-data-rest-tests/spring-data-rest-tests-jpa/src/test/java/org/springframework/data/rest/webmvc/jpa/JpaWebTests.java index 9314af7a0..8cb16ef25 100755 --- a/spring-data-rest-tests/spring-data-rest-tests-jpa/src/test/java/org/springframework/data/rest/webmvc/jpa/JpaWebTests.java +++ b/spring-data-rest-tests/spring-data-rest-tests-jpa/src/test/java/org/springframework/data/rest/webmvc/jpa/JpaWebTests.java @@ -41,7 +41,7 @@ import org.springframework.hateoas.IanaLinkRelations; import org.springframework.hateoas.Link; import org.springframework.hateoas.LinkRelation; import org.springframework.hateoas.Links; -import org.springframework.hateoas.server.RelProvider; +import org.springframework.hateoas.server.LinkRelationProvider; import org.springframework.http.MediaType; import org.springframework.mock.web.MockHttpServletResponse; import org.springframework.test.context.ContextConfiguration; @@ -71,7 +71,7 @@ public class JpaWebTests extends CommonWebTests { @Autowired TestDataPopulator loader; @Autowired ResourceMappings mappings; - @Autowired RelProvider relProvider; + @Autowired LinkRelationProvider relProvider; ObjectMapper mapper = new ObjectMapper(); diff --git a/spring-data-rest-tests/spring-data-rest-tests-jpa/src/test/java/org/springframework/data/rest/webmvc/json/RepositoryTestsConfig.java b/spring-data-rest-tests/spring-data-rest-tests-jpa/src/test/java/org/springframework/data/rest/webmvc/json/RepositoryTestsConfig.java index 1f0757202..5d064009e 100644 --- a/spring-data-rest-tests/spring-data-rest-tests-jpa/src/test/java/org/springframework/data/rest/webmvc/json/RepositoryTestsConfig.java +++ b/spring-data-rest-tests/spring-data-rest-tests-jpa/src/test/java/org/springframework/data/rest/webmvc/json/RepositoryTestsConfig.java @@ -50,11 +50,11 @@ import org.springframework.data.rest.webmvc.support.PagingAndSortingTemplateVari import org.springframework.data.rest.webmvc.support.RepositoryEntityLinks; import org.springframework.format.support.DefaultFormattingConversionService; import org.springframework.format.support.FormattingConversionService; -import org.springframework.hateoas.server.EntityLinks; -import org.springframework.hateoas.server.RelProvider; -import org.springframework.hateoas.server.RepresentationModelProcessor; -import org.springframework.hateoas.server.core.EvoInflectorRelProvider; import org.springframework.hateoas.mediatype.hal.Jackson2HalModule; +import org.springframework.hateoas.server.EntityLinks; +import org.springframework.hateoas.server.LinkRelationProvider; +import org.springframework.hateoas.server.RepresentationModelProcessor; +import org.springframework.hateoas.server.core.EvoInflectorLinkRelationProvider; import org.springframework.hateoas.server.mvc.RepresentationModelProcessorInvoker; import org.springframework.plugin.core.PluginRegistry; @@ -136,7 +136,7 @@ public class RepositoryTestsConfig { @Bean public ObjectMapper objectMapper() { - RelProvider relProvider = new EvoInflectorRelProvider(); + LinkRelationProvider relProvider = new EvoInflectorLinkRelationProvider(); ObjectMapper mapper = new ObjectMapper(); mapper.registerModule(new Jackson2HalModule()); 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 7d1632421..d59304418 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 @@ -97,16 +97,16 @@ import org.springframework.data.web.config.HateoasAwareSpringDataWebConfiguratio import org.springframework.data.web.config.SpringDataJacksonConfiguration; import org.springframework.format.support.DefaultFormattingConversionService; import org.springframework.hateoas.MediaTypes; -import org.springframework.hateoas.server.RelProvider; -import org.springframework.hateoas.server.RepresentationModelProcessor; import org.springframework.hateoas.RepresentationModel; import org.springframework.hateoas.config.EnableHypermediaSupport; import org.springframework.hateoas.config.EnableHypermediaSupport.HypermediaType; -import org.springframework.hateoas.server.core.EvoInflectorRelProvider; import org.springframework.hateoas.mediatype.hal.CurieProvider; import org.springframework.hateoas.mediatype.hal.HalConfiguration; import org.springframework.hateoas.mediatype.hal.Jackson2HalModule; import org.springframework.hateoas.mediatype.hal.Jackson2HalModule.HalHandlerInstantiator; +import org.springframework.hateoas.server.LinkRelationProvider; +import org.springframework.hateoas.server.RepresentationModelProcessor; +import org.springframework.hateoas.server.core.EvoInflectorLinkRelationProvider; import org.springframework.hateoas.server.mvc.RepresentationModelProcessorInvoker; import org.springframework.hateoas.server.mvc.TypeConstrainedMappingJackson2HttpMessageConverter; import org.springframework.http.MediaType; @@ -160,7 +160,7 @@ public class RepositoryRestMvcConfiguration extends HateoasAwareSpringDataWebCon @Autowired(required = false) List configurers = Collections.emptyList(); @Autowired(required = false) List> lookups = Collections.emptyList(); - @Autowired Optional relProvider; + @Autowired Optional relProvider; @Autowired Optional curieProvider; @Autowired Optional halConfiguration; @Autowired ObjectProvider objectMapper; @@ -499,7 +499,7 @@ public class RepositoryRestMvcConfiguration extends HateoasAwareSpringDataWebCon public ObjectMapper halObjectMapper() { - RelProvider defaultedRelProvider = this.relProvider.orElseGet(EvoInflectorRelProvider::new); + LinkRelationProvider defaultedRelProvider = this.relProvider.orElseGet(EvoInflectorLinkRelationProvider::new); HalConfiguration halConfiguration = this.halConfiguration.orElseGet(HalConfiguration::new); HalHandlerInstantiator instantiator = new HalHandlerInstantiator(defaultedRelProvider, curieProvider.orElse(null), @@ -527,8 +527,8 @@ public class RepositoryRestMvcConfiguration extends HateoasAwareSpringDataWebCon @SuppressWarnings("rawtypes") public RepresentationModelProcessorInvoker resourceProcessorInvoker() { - Collection beans = applicationContext.getBeansOfType(RepresentationModelProcessor.class, false, false) - .values(); + Collection beans = applicationContext + .getBeansOfType(RepresentationModelProcessor.class, false, false).values(); List> processors = new ArrayList>(beans.size()); for (RepresentationModelProcessor bean : beans) { diff --git a/spring-data-rest-webmvc/src/test/java/org/springframework/data/rest/webmvc/config/RepositoryRestMvConfigurationIntegrationTests.java b/spring-data-rest-webmvc/src/test/java/org/springframework/data/rest/webmvc/config/RepositoryRestMvConfigurationIntegrationTests.java index 5217fdf8a..be1f672de 100755 --- a/spring-data-rest-webmvc/src/test/java/org/springframework/data/rest/webmvc/config/RepositoryRestMvConfigurationIntegrationTests.java +++ b/spring-data-rest-webmvc/src/test/java/org/springframework/data/rest/webmvc/config/RepositoryRestMvConfigurationIntegrationTests.java @@ -49,9 +49,9 @@ import org.springframework.data.rest.webmvc.json.PersistentEntityJackson2Module; import org.springframework.data.web.HateoasPageableHandlerMethodArgumentResolver; import org.springframework.data.web.PageableHandlerMethodArgumentResolver; import org.springframework.format.datetime.DateFormatter; -import org.springframework.hateoas.client.LinkDiscoverers; import org.springframework.hateoas.MediaTypes; -import org.springframework.hateoas.server.core.DefaultRelProvider; +import org.springframework.hateoas.client.LinkDiscoverers; +import org.springframework.hateoas.server.core.DefaultLinkRelationProvider; import org.springframework.hateoas.server.mvc.TypeConstrainedMappingJackson2HttpMessageConverter; import org.springframework.http.converter.HttpMessageConverter; import org.springframework.http.converter.json.AbstractJackson2HttpMessageConverter; @@ -218,8 +218,8 @@ public class RepositoryRestMvConfigurationIntegrationTests { static class ExtendingConfiguration { @Bean - DefaultRelProvider relProvider() { - return new DefaultRelProvider(); + DefaultLinkRelationProvider relProvider() { + return new DefaultLinkRelationProvider(); } @Bean diff --git a/spring-data-rest-webmvc/src/test/java/org/springframework/data/rest/webmvc/json/ProjectionJacksonIntegrationTests.java b/spring-data-rest-webmvc/src/test/java/org/springframework/data/rest/webmvc/json/ProjectionJacksonIntegrationTests.java index d96b50012..64f4635c8 100755 --- a/spring-data-rest-webmvc/src/test/java/org/springframework/data/rest/webmvc/json/ProjectionJacksonIntegrationTests.java +++ b/spring-data-rest-webmvc/src/test/java/org/springframework/data/rest/webmvc/json/ProjectionJacksonIntegrationTests.java @@ -24,16 +24,16 @@ import org.junit.Test; import org.springframework.data.projection.ProjectionFactory; import org.springframework.data.projection.SpelAwareProxyProjectionFactory; import org.springframework.hateoas.CollectionModel; -import org.springframework.hateoas.server.core.EvoInflectorRelProvider; import org.springframework.hateoas.mediatype.hal.Jackson2HalModule; import org.springframework.hateoas.mediatype.hal.Jackson2HalModule.HalHandlerInstantiator; +import org.springframework.hateoas.server.core.EvoInflectorLinkRelationProvider; import com.fasterxml.jackson.annotation.JsonIgnore; import com.fasterxml.jackson.databind.ObjectMapper; import com.jayway.jsonpath.JsonPath; /** - * Integration tests for Jackson marshalling of projected objects. + * Integration tests for Jackson marshaling of projected objects. * * @author Oliver Gierke */ @@ -47,7 +47,7 @@ public class ProjectionJacksonIntegrationTests { this.mapper = new ObjectMapper(); this.mapper.registerModule(new Jackson2HalModule()); - this.mapper.setHandlerInstantiator(new HalHandlerInstantiator(new EvoInflectorRelProvider(), null, null)); + this.mapper.setHandlerInstantiator(new HalHandlerInstantiator(new EvoInflectorLinkRelationProvider(), null, null)); } @Test // DATAREST-221 @@ -61,7 +61,7 @@ public class ProjectionJacksonIntegrationTests { CustomerProjection projection = factory.createProjection(CustomerProjection.class, customer); String result = mapper.writeValueAsString(projection); - assertThat(JsonPath. read(result, "$.firstname")).isEqualTo((Object) "Dave"); + assertThat(JsonPath. read(result, "$.firstname")).isEqualTo("Dave"); } @Test // DATAREST-221 @@ -70,7 +70,7 @@ public class ProjectionJacksonIntegrationTests { ObjectMapper mapper = new ObjectMapper(); mapper.registerModule(new Jackson2HalModule()); mapper.setHandlerInstantiator( - new Jackson2HalModule.HalHandlerInstantiator(new EvoInflectorRelProvider(), null, null)); + new Jackson2HalModule.HalHandlerInstantiator(new EvoInflectorLinkRelationProvider(), null, null)); Customer customer = new Customer(); customer.firstname = "Dave"; @@ -82,7 +82,7 @@ public class ProjectionJacksonIntegrationTests { String result = mapper.writeValueAsString(resources); - assertThat(JsonPath. read(result, "$._embedded.customers[0].firstname")).isEqualTo((Object) "Dave"); + assertThat(JsonPath. read(result, "$._embedded.customers[0].firstname")).isEqualTo("Dave"); } static class Customer {