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.
This commit is contained in:
Oliver Gierke
2016-06-12 14:33:27 +02:00
parent f21e150692
commit 9e5fd30c68
10 changed files with 19 additions and 465 deletions

View File

@@ -1,5 +1,5 @@
/*
* Copyright 2012-2015 the original author or authors.
* Copyright 2012-2016 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -30,20 +30,22 @@ import org.springframework.web.servlet.mvc.method.annotation.RequestMappingHandl
* their Spring MVC context.
*
* @author Jon Brisbin
* @author Oliver Gierke
*/
public class RepositoryRestHandlerAdapter extends ResourceProcessorInvokingHandlerAdapter {
public class RepositoryRestHandlerAdapter
extends org.springframework.hateoas.mvc.ResourceProcessorInvokingHandlerAdapter {
private final List<HandlerMethodArgumentResolver> argumentResolvers;
/**
* Creates a new {@link RepositoryRestHandlerAdapter} using the given {@link HandlerMethodArgumentResolver} and
* {@link ResourceProcessorInvoker}.
* {@link org.springframework.hateoas.mvc.ResourceProcessorInvoker}.
*
* @param argumentResolvers must not be {@literal null}.
* @param invoker must not be {@literal null}.
*/
public RepositoryRestHandlerAdapter(List<HandlerMethodArgumentResolver> argumentResolvers,
ResourceProcessorInvoker invoker) {
org.springframework.hateoas.mvc.ResourceProcessorInvoker invoker) {
super(invoker);
this.argumentResolvers = argumentResolvers;

View File

@@ -1,5 +1,5 @@
/*
* Copyright 2012 the original author or authors.
* Copyright 2012-2016 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -39,7 +39,9 @@ import org.springframework.web.method.support.ModelAndViewContainer;
* configured {@link ResourceProcessor}s.
*
* @author Oliver Gierke
* @deprecated use the same type from Spring HATEOAS, will be removed in 2.7.
*/
@Deprecated
@RequiredArgsConstructor
public class ResourceProcessorHandlerMethodReturnValueHandler implements HandlerMethodReturnValueHandler {

View File

@@ -38,7 +38,9 @@ import org.springframework.util.ReflectionUtils;
*
* @author Oliver Gierke
* @since 2.5
* @deprecated use the same type from Spring HATEOAS, will be removed in 2.7.
*/
@Deprecated
public class ResourceProcessorInvoker {
private final List<ProcessorWrapper> processors;

View File

@@ -1,5 +1,5 @@
/*
* Copyright 2012-2013 the original author or authors.
* Copyright 2012-2016 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -38,7 +38,9 @@ import org.springframework.web.servlet.mvc.method.annotation.RequestMappingHandl
*
* @author Oliver Gierke
* @author Phil Webb
* @deprecated use the same type from Spring HATEOAS, will be removed in 2.7.
*/
@Deprecated
public class ResourceProcessorInvokingHandlerAdapter extends RequestMappingHandlerAdapter {
private static final Method RETURN_VALUE_HANDLER_METHOD = ReflectionUtils

View File

@@ -81,7 +81,6 @@ import org.springframework.data.rest.webmvc.RepositoryRestController;
import org.springframework.data.rest.webmvc.RepositoryRestExceptionHandler;
import org.springframework.data.rest.webmvc.RepositoryRestHandlerAdapter;
import org.springframework.data.rest.webmvc.RepositoryRestHandlerMapping;
import org.springframework.data.rest.webmvc.ResourceProcessorInvoker;
import org.springframework.data.rest.webmvc.RestMediaTypes;
import org.springframework.data.rest.webmvc.ServerHttpRequestMethodArgumentResolver;
import org.springframework.data.rest.webmvc.alps.AlpsJsonHttpMessageConverter;
@@ -127,6 +126,7 @@ import org.springframework.hateoas.core.EvoInflectorRelProvider;
import org.springframework.hateoas.hal.CurieProvider;
import org.springframework.hateoas.hal.Jackson2HalModule;
import org.springframework.hateoas.hal.Jackson2HalModule.HalHandlerInstantiator;
import org.springframework.hateoas.mvc.ResourceProcessorInvoker;
import org.springframework.hateoas.mvc.TypeConstrainedMappingJackson2HttpMessageConverter;
import org.springframework.http.MediaType;
import org.springframework.http.converter.HttpMessageConverter;
@@ -845,7 +845,6 @@ public class RepositoryRestMvcConfiguration extends HateoasAwareSpringDataWebCon
RepositoryEntityLinks entityLinks = entityLinks();
MessageSourceAccessor messageSourceAccessor = resourceDescriptionMessageSourceAccessor();
RepositoryRestConfiguration config = config();
ResourceMappings resourceMappings = resourceMappings();
return new RootResourceInformationToAlpsDescriptorConverter(associationLinks(), repositories, persistentEntities,
entityLinks, messageSourceAccessor, config, objectMapper(), enumTranslator());

View File

@@ -43,13 +43,13 @@ import org.springframework.data.rest.core.support.EntityLookup;
import org.springframework.data.rest.core.support.SelfLinkProvider;
import org.springframework.data.rest.webmvc.EmbeddedResourcesAssembler;
import org.springframework.data.rest.webmvc.PersistentEntityResource;
import org.springframework.data.rest.webmvc.ResourceProcessorInvoker;
import org.springframework.data.rest.webmvc.mapping.Associations;
import org.springframework.data.rest.webmvc.mapping.LinkCollector;
import org.springframework.hateoas.Link;
import org.springframework.hateoas.Links;
import org.springframework.hateoas.Resource;
import org.springframework.hateoas.UriTemplate;
import org.springframework.hateoas.mvc.ResourceProcessorInvoker;
import org.springframework.plugin.core.PluginRegistry;
import org.springframework.util.Assert;
import org.springframework.util.StringUtils;
@@ -148,7 +148,6 @@ public class PersistentEntityJackson2Module extends SimpleModule {
*
* @param entities must not be {@literal null}.
*/
@SuppressWarnings({ "unchecked", "rawtypes" })
private PersistentEntityResourceSerializer(LinkCollector collector) {
super(PersistentEntityResource.class);