Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
DATAREST-964 - Removed deprecated configuration methods in Repository…
…RestMvcConfiguration.
  • Loading branch information
odrotbohm committed Dec 20, 2016
1 parent bccb5fd commit 8c1ee56
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 77 deletions.
@@ -1,5 +1,5 @@
/*
* Copyright 2015 the original author or authors.
* Copyright 2015-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.
Expand All @@ -23,8 +23,10 @@
import org.junit.Test;
import org.junit.runner.RunWith;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import org.springframework.data.rest.core.config.RepositoryRestConfiguration;
import org.springframework.data.rest.webmvc.config.RepositoryRestConfigurerAdapter;
import org.springframework.data.rest.webmvc.config.RepositoryRestMvcConfiguration;
import org.springframework.hateoas.MediaTypes;
import org.springframework.http.HttpHeaders;
Expand Down Expand Up @@ -56,9 +58,16 @@ public class HalBrowserIntegrationTests {
@EnableWebMvc
static class TestConfiguration extends RepositoryRestMvcConfiguration {

@Override
protected void configureRepositoryRestConfiguration(RepositoryRestConfiguration config) {
config.setBasePath(BASE_PATH);
@Bean
RepositoryRestConfigurerAdapter configExtension() {

return new RepositoryRestConfigurerAdapter() {

@Override
public void configureRepositoryRestConfiguration(RepositoryRestConfiguration config) {
config.setBasePath(BASE_PATH);
}
};
}
}

Expand Down
Expand Up @@ -42,7 +42,6 @@
import org.springframework.context.support.ReloadableResourceBundleMessageSource;
import org.springframework.core.Ordered;
import org.springframework.core.convert.ConversionService;
import org.springframework.core.convert.support.ConfigurableConversionService;
import org.springframework.core.io.ClassPathResource;
import org.springframework.data.auditing.AuditableBeanWrapperFactory;
import org.springframework.data.auditing.MappingAuditableBeanWrapperFactory;
Expand Down Expand Up @@ -231,7 +230,6 @@ public DefaultFormattingConversionService defaultConversionService() {
addFormatters(conversionService);

configurerDelegate.configureConversionService(conversionService);
configureConversionService(conversionService);

return conversionService;
}
Expand All @@ -246,7 +244,6 @@ public ValidatingRepositoryEventListener validatingRepositoryEventListener(

ValidatingRepositoryEventListener listener = new ValidatingRepositoryEventListener(entities);
configurerDelegate.configureValidatingRepositoryEventListener(listener);
configureValidatingRepositoryEventListener(listener);

return listener;
}
Expand Down Expand Up @@ -276,7 +273,6 @@ public RepositoryRestConfiguration config() {
RepositoryRestConfiguration config = new RepositoryRestConfiguration(configuration, metadataConfiguration(),
enumTranslator());
configurerDelegate.configureRepositoryRestConfiguration(config);
configureRepositoryRestConfiguration(config);

return config;
}
Expand Down Expand Up @@ -677,7 +673,6 @@ public ExceptionHandlerExceptionResolver exceptionHandlerExceptionResolver() {
er.setMessageConverters(defaultMessageConverters());

configurerDelegate.configureExceptionHandlerExceptionResolver(er);
configureExceptionHandlerExceptionResolver(er);

return er;
}
Expand Down Expand Up @@ -718,7 +713,6 @@ public List<HttpMessageConverter<?>> defaultMessageConverters() {
messageConverters.add(uriListHttpMessageConverter());

configurerDelegate.configureHttpMessageConverters(messageConverters);
configureHttpMessageConverters(messageConverters);

return messageConverters;
}
Expand Down Expand Up @@ -843,7 +837,6 @@ protected ObjectMapper basicObjectMapper() {
Jackson2DatatypeHelper.configureObjectMapper(objectMapper);
// Configure custom Modules
configurerDelegate.configureJacksonObjectMapper(objectMapper);
configureJacksonObjectMapper(objectMapper);

return objectMapper;
}
Expand Down Expand Up @@ -938,70 +931,4 @@ public int getOrder() {
return order;
}
}

/**
* Override this method to add additional configuration.
*
* @param config Main configuration bean.
* @deprecated since 2.4, implement
* {@link RepositoryRestConfigurer#configureRepositoryRestConfiguration(RepositoryRestConfiguration)}
* either directly or extend {@link RepositoryRestConfigurerAdapter} and override the method.
*/
@Deprecated
protected void configureRepositoryRestConfiguration(RepositoryRestConfiguration config) {}

/**
* Override this method to add your own converters.
*
* @param conversionService Default ConversionService bean.
* @deprecated since 2.4, implement
* {@link RepositoryRestConfigurer#configureConversionService(ConfigurableConversionService)} either
* directly or extend {@link RepositoryRestConfigurerAdapter} and override the method.
*/
@Deprecated
protected void configureConversionService(ConfigurableConversionService conversionService) {}

/**
* Override this method to add validators manually.
*
* @param validatingListener The {@link org.springframework.context.ApplicationListener} responsible for invoking
* {@link org.springframework.validation.Validator} instances.
* @deprecated since 2.4, implement
* {@link RepositoryRestConfigurer#configureValidatingRepositoryEventListener(ValidatingRepositoryEventListener)}
* either directly or extend {@link RepositoryRestConfigurerAdapter} and override the method.
*/
@Deprecated
protected void configureValidatingRepositoryEventListener(ValidatingRepositoryEventListener validatingListener) {}

/**
* Configure the {@link ExceptionHandlerExceptionResolver}.
*
* @param exceptionResolver The default exception resolver on which you can add custom argument resolvers.
* @deprecated since 2.4, implement
* {@link RepositoryRestConfigurer#configureExceptionHandlerExceptionResolver(ExceptionHandlerExceptionResolver)}
* either directly or extend {@link RepositoryRestConfigurerAdapter} and override the method.
*/
@Deprecated
protected void configureExceptionHandlerExceptionResolver(ExceptionHandlerExceptionResolver exceptionResolver) {}

/**
* Configure the available {@link HttpMessageConverter}s by adding your own.
*
* @param messageConverters The converters to be used by the system.
* @deprecated since 2.4, implement {@link RepositoryRestConfigurer#configureHttpMessageConverters(List)} either
* directly or extend {@link RepositoryRestConfigurerAdapter} and override the method.
*/
@Deprecated
protected void configureHttpMessageConverters(List<HttpMessageConverter<?>> messageConverters) {}

/**
* Configure the Jackson {@link ObjectMapper} directly.
*
* @param objectMapper The {@literal ObjectMapper} to be used by the system.
* @deprecated since 2.4, implement {@link RepositoryRestConfigurer#configureJacksonObjectMapper(ObjectMapper)} either
* directly or extend {@link RepositoryRestConfigurerAdapter} and override the method.
*/
@Deprecated
protected void configureJacksonObjectMapper(ObjectMapper objectMapper) {}

}

0 comments on commit 8c1ee56

Please sign in to comment.