Skip to content

Commit 9e5fd30

Browse files
committed
DATAREST-837 - Move to ResourceProcessor invcation infrastructure in Spring HATEOAS.
Deprecated the ResourceProcessor invoking infrastructure in place here in favor of the types moved to Spring HATEOAS. Refactored our codebase to make use of these newly introduced types right away. Related tickets: spring-projects/spring-hateoas#362.
1 parent f21e150 commit 9e5fd30

File tree

10 files changed

+19
-465
lines changed

10 files changed

+19
-465
lines changed

spring-data-rest-tests/spring-data-rest-tests-core/src/test/java/org/springframework/data/rest/tests/RepositoryTestsConfig.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,6 @@
4040
import org.springframework.data.rest.core.support.EntityLookup;
4141
import org.springframework.data.rest.core.support.SelfLinkProvider;
4242
import org.springframework.data.rest.webmvc.EmbeddedResourcesAssembler;
43-
import org.springframework.data.rest.webmvc.ResourceProcessorInvoker;
4443
import org.springframework.data.rest.webmvc.json.PersistentEntityJackson2Module;
4544
import org.springframework.data.rest.webmvc.json.PersistentEntityJackson2Module.LookupObjectSerializer;
4645
import org.springframework.data.rest.webmvc.json.PersistentEntityJackson2Module.NestedEntitySerializer;
@@ -58,6 +57,7 @@
5857
import org.springframework.hateoas.ResourceProcessor;
5958
import org.springframework.hateoas.core.EvoInflectorRelProvider;
6059
import org.springframework.hateoas.hal.Jackson2HalModule;
60+
import org.springframework.hateoas.mvc.ResourceProcessorInvoker;
6161
import org.springframework.plugin.core.OrderAwarePluginRegistry;
6262

6363
import com.fasterxml.jackson.annotation.JsonInclude.Include;

spring-data-rest-tests/spring-data-rest-tests-jpa/src/test/java/org/springframework/data/rest/webmvc/json/RepositoryTestsConfig.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,6 @@
4040
import org.springframework.data.rest.core.support.EntityLookup;
4141
import org.springframework.data.rest.core.support.SelfLinkProvider;
4242
import org.springframework.data.rest.webmvc.EmbeddedResourcesAssembler;
43-
import org.springframework.data.rest.webmvc.ResourceProcessorInvoker;
4443
import org.springframework.data.rest.webmvc.jpa.Person;
4544
import org.springframework.data.rest.webmvc.jpa.PersonRepository;
4645
import org.springframework.data.rest.webmvc.json.PersistentEntityJackson2Module.LookupObjectSerializer;
@@ -59,6 +58,7 @@
5958
import org.springframework.hateoas.ResourceProcessor;
6059
import org.springframework.hateoas.core.EvoInflectorRelProvider;
6160
import org.springframework.hateoas.hal.Jackson2HalModule;
61+
import org.springframework.hateoas.mvc.ResourceProcessorInvoker;
6262
import org.springframework.plugin.core.OrderAwarePluginRegistry;
6363

6464
import com.fasterxml.jackson.annotation.JsonInclude.Include;

spring-data-rest-webmvc/src/main/java/org/springframework/data/rest/webmvc/RepositoryRestHandlerAdapter.java

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* Copyright 2012-2015 the original author or authors.
2+
* Copyright 2012-2016 the original author or authors.
33
*
44
* Licensed under the Apache License, Version 2.0 (the "License");
55
* you may not use this file except in compliance with the License.
@@ -30,20 +30,22 @@
3030
* their Spring MVC context.
3131
*
3232
* @author Jon Brisbin
33+
* @author Oliver Gierke
3334
*/
34-
public class RepositoryRestHandlerAdapter extends ResourceProcessorInvokingHandlerAdapter {
35+
public class RepositoryRestHandlerAdapter
36+
extends org.springframework.hateoas.mvc.ResourceProcessorInvokingHandlerAdapter {
3537

3638
private final List<HandlerMethodArgumentResolver> argumentResolvers;
3739

3840
/**
3941
* Creates a new {@link RepositoryRestHandlerAdapter} using the given {@link HandlerMethodArgumentResolver} and
40-
* {@link ResourceProcessorInvoker}.
42+
* {@link org.springframework.hateoas.mvc.ResourceProcessorInvoker}.
4143
*
4244
* @param argumentResolvers must not be {@literal null}.
4345
* @param invoker must not be {@literal null}.
4446
*/
4547
public RepositoryRestHandlerAdapter(List<HandlerMethodArgumentResolver> argumentResolvers,
46-
ResourceProcessorInvoker invoker) {
48+
org.springframework.hateoas.mvc.ResourceProcessorInvoker invoker) {
4749

4850
super(invoker);
4951
this.argumentResolvers = argumentResolvers;

spring-data-rest-webmvc/src/main/java/org/springframework/data/rest/webmvc/ResourceProcessorHandlerMethodReturnValueHandler.java

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* Copyright 2012 the original author or authors.
2+
* Copyright 2012-2016 the original author or authors.
33
*
44
* Licensed under the Apache License, Version 2.0 (the "License");
55
* you may not use this file except in compliance with the License.
@@ -39,7 +39,9 @@
3939
* configured {@link ResourceProcessor}s.
4040
*
4141
* @author Oliver Gierke
42+
* @deprecated use the same type from Spring HATEOAS, will be removed in 2.7.
4243
*/
44+
@Deprecated
4345
@RequiredArgsConstructor
4446
public class ResourceProcessorHandlerMethodReturnValueHandler implements HandlerMethodReturnValueHandler {
4547

spring-data-rest-webmvc/src/main/java/org/springframework/data/rest/webmvc/ResourceProcessorInvoker.java

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,9 @@
3838
*
3939
* @author Oliver Gierke
4040
* @since 2.5
41+
* @deprecated use the same type from Spring HATEOAS, will be removed in 2.7.
4142
*/
43+
@Deprecated
4244
public class ResourceProcessorInvoker {
4345

4446
private final List<ProcessorWrapper> processors;

spring-data-rest-webmvc/src/main/java/org/springframework/data/rest/webmvc/ResourceProcessorInvokingHandlerAdapter.java

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* Copyright 2012-2013 the original author or authors.
2+
* Copyright 2012-2016 the original author or authors.
33
*
44
* Licensed under the Apache License, Version 2.0 (the "License");
55
* you may not use this file except in compliance with the License.
@@ -38,7 +38,9 @@
3838
*
3939
* @author Oliver Gierke
4040
* @author Phil Webb
41+
* @deprecated use the same type from Spring HATEOAS, will be removed in 2.7.
4142
*/
43+
@Deprecated
4244
public class ResourceProcessorInvokingHandlerAdapter extends RequestMappingHandlerAdapter {
4345

4446
private static final Method RETURN_VALUE_HANDLER_METHOD = ReflectionUtils

spring-data-rest-webmvc/src/main/java/org/springframework/data/rest/webmvc/config/RepositoryRestMvcConfiguration.java

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -81,7 +81,6 @@
8181
import org.springframework.data.rest.webmvc.RepositoryRestExceptionHandler;
8282
import org.springframework.data.rest.webmvc.RepositoryRestHandlerAdapter;
8383
import org.springframework.data.rest.webmvc.RepositoryRestHandlerMapping;
84-
import org.springframework.data.rest.webmvc.ResourceProcessorInvoker;
8584
import org.springframework.data.rest.webmvc.RestMediaTypes;
8685
import org.springframework.data.rest.webmvc.ServerHttpRequestMethodArgumentResolver;
8786
import org.springframework.data.rest.webmvc.alps.AlpsJsonHttpMessageConverter;
@@ -127,6 +126,7 @@
127126
import org.springframework.hateoas.hal.CurieProvider;
128127
import org.springframework.hateoas.hal.Jackson2HalModule;
129128
import org.springframework.hateoas.hal.Jackson2HalModule.HalHandlerInstantiator;
129+
import org.springframework.hateoas.mvc.ResourceProcessorInvoker;
130130
import org.springframework.hateoas.mvc.TypeConstrainedMappingJackson2HttpMessageConverter;
131131
import org.springframework.http.MediaType;
132132
import org.springframework.http.converter.HttpMessageConverter;
@@ -845,7 +845,6 @@ public RootResourceInformationToAlpsDescriptorConverter alpsConverter() {
845845
RepositoryEntityLinks entityLinks = entityLinks();
846846
MessageSourceAccessor messageSourceAccessor = resourceDescriptionMessageSourceAccessor();
847847
RepositoryRestConfiguration config = config();
848-
ResourceMappings resourceMappings = resourceMappings();
849848

850849
return new RootResourceInformationToAlpsDescriptorConverter(associationLinks(), repositories, persistentEntities,
851850
entityLinks, messageSourceAccessor, config, objectMapper(), enumTranslator());

spring-data-rest-webmvc/src/main/java/org/springframework/data/rest/webmvc/json/PersistentEntityJackson2Module.java

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -43,13 +43,13 @@
4343
import org.springframework.data.rest.core.support.SelfLinkProvider;
4444
import org.springframework.data.rest.webmvc.EmbeddedResourcesAssembler;
4545
import org.springframework.data.rest.webmvc.PersistentEntityResource;
46-
import org.springframework.data.rest.webmvc.ResourceProcessorInvoker;
4746
import org.springframework.data.rest.webmvc.mapping.Associations;
4847
import org.springframework.data.rest.webmvc.mapping.LinkCollector;
4948
import org.springframework.hateoas.Link;
5049
import org.springframework.hateoas.Links;
5150
import org.springframework.hateoas.Resource;
5251
import org.springframework.hateoas.UriTemplate;
52+
import org.springframework.hateoas.mvc.ResourceProcessorInvoker;
5353
import org.springframework.plugin.core.PluginRegistry;
5454
import org.springframework.util.Assert;
5555
import org.springframework.util.StringUtils;
@@ -148,7 +148,6 @@ private static class PersistentEntityResourceSerializer extends StdSerializer<Pe
148148
*
149149
* @param entities must not be {@literal null}.
150150
*/
151-
@SuppressWarnings({ "unchecked", "rawtypes" })
152151
private PersistentEntityResourceSerializer(LinkCollector collector) {
153152

154153
super(PersistentEntityResource.class);

0 commit comments

Comments
 (0)