package org.restler.spring.data;

import com.fasterxml.jackson.databind.Module;
import org.restler.RestlerConfig;
import org.restler.client.CGLibClientFactory;
import org.restler.client.CachingClientFactory;
import org.restler.client.CallEnhancer;
import org.restler.client.CoreModule;
import org.restler.http.RequestExecutor;
import org.restler.spring.data.chain.ChainCallEnhancer;
import org.restler.spring.data.proxy.ProxyCallEnhancer;
import org.springframework.http.converter.json.MappingJackson2HttpMessageConverter;
import org.springframework.web.client.RestTemplate;

import java.util.ArrayList;
import java.util.List;
import java.util.Optional;
import java.util.function.Function;
import java.util.stream.Collectors;

public class SpringDataSupport implements Function<RestlerConfig, CoreModule> {

    private final List<Module> jacksonModules = new ArrayList<>();

    private Optional<RequestExecutor> requestExecutor = Optional.empty();

    private final List<Class<?>> repositories;

    private long cacheSize;

    public SpringDataSupport(List<Class<?>> repositories, long maxCacheSize) {
        this.repositories = repositories;
        this.cacheSize = maxCacheSize;
    }

    @Override
    public CoreModule apply(RestlerConfig config) {
        List<CallEnhancer> totalEnhancers = new ArrayList<>();
        totalEnhancers.add(new ChainCallEnhancer());
        totalEnhancers.add(new ProxyCallEnhancer(cacheSize));
        totalEnhancers.add(new SdrErrorMappingEnhancer());
        totalEnhancers.addAll(config.getEnhancers());

        return new SpringData(new CachingClientFactory(new CGLibClientFactory()), config.getBaseUri(), requestExecutor.orElseGet(this::createExecutor),  totalEnhancers, repositories);
    }

    public SpringDataSupport addJacksonModule(Module module) {
        jacksonModules.add(module);
        return this;
    }

    public SpringDataSupport requestExecutor(RequestExecutor requestExecutor) {
        this.requestExecutor = Optional.of(requestExecutor);
        return this;
    }

    private SpringDataRequestExecutor createExecutor() {
        RestTemplate restTemplate = new RestTemplate();

        List<MappingJackson2HttpMessageConverter> jacksonConverters = restTemplate.getMessageConverters().stream().
                filter(converter -> converter instanceof MappingJackson2HttpMessageConverter).
                map(converter -> (MappingJackson2HttpMessageConverter) converter).
                collect(Collectors.toList());

        jacksonModules.stream().forEach(module ->
                jacksonConverters.forEach(converter ->
                        converter.getObjectMapper().registerModule(module)));

        restTemplate.getMessageConverters().add(0, new SpringDataRestMessageConverter());
        return new SpringDataRequestExecutor(restTemplate);
    }

}

@@ -424,32 +424,95 @@
 xyCallEnhancer;%0A
+import org.restler.spring.mvc.spring.SpringMvcRequestExecutor;%0A
 import org.sprin
@@ -2108,26 +2108,16 @@
 private 
-SpringData
 RequestE
@@ -2840,20 +2840,19 @@
 w Spring
-Data
+Mvc
 RequestE

Change using SpringDataRequestExecutor to SpringMvcRequestExecutor.