Skip to content

Commit 839682d

Browse files
committed
DATAREST-964 - Removed deprecated configuration methods in RepositoryRestMvcConfiguration.
1 parent 7a47365 commit 839682d

File tree

2 files changed

+13
-77
lines changed

2 files changed

+13
-77
lines changed

spring-data-rest-hal-browser/src/test/java/org/springframework/data/rest/webmvc/halbrowser/HalBrowserIntegrationTests.java

+13-4
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* Copyright 2015 the original author or authors.
2+
* Copyright 2015-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.
@@ -23,8 +23,10 @@
2323
import org.junit.Test;
2424
import org.junit.runner.RunWith;
2525
import org.springframework.beans.factory.annotation.Autowired;
26+
import org.springframework.context.annotation.Bean;
2627
import org.springframework.context.annotation.Configuration;
2728
import org.springframework.data.rest.core.config.RepositoryRestConfiguration;
29+
import org.springframework.data.rest.webmvc.config.RepositoryRestConfigurerAdapter;
2830
import org.springframework.data.rest.webmvc.config.RepositoryRestMvcConfiguration;
2931
import org.springframework.hateoas.MediaTypes;
3032
import org.springframework.http.HttpHeaders;
@@ -56,9 +58,16 @@ public class HalBrowserIntegrationTests {
5658
@EnableWebMvc
5759
static class TestConfiguration extends RepositoryRestMvcConfiguration {
5860

59-
@Override
60-
protected void configureRepositoryRestConfiguration(RepositoryRestConfiguration config) {
61-
config.setBasePath(BASE_PATH);
61+
@Bean
62+
RepositoryRestConfigurerAdapter configExtension() {
63+
64+
return new RepositoryRestConfigurerAdapter() {
65+
66+
@Override
67+
public void configureRepositoryRestConfiguration(RepositoryRestConfiguration config) {
68+
config.setBasePath(BASE_PATH);
69+
}
70+
};
6271
}
6372
}
6473

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

-73
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,6 @@
4242
import org.springframework.context.support.ReloadableResourceBundleMessageSource;
4343
import org.springframework.core.Ordered;
4444
import org.springframework.core.convert.ConversionService;
45-
import org.springframework.core.convert.support.ConfigurableConversionService;
4645
import org.springframework.core.io.ClassPathResource;
4746
import org.springframework.data.auditing.AuditableBeanWrapperFactory;
4847
import org.springframework.data.auditing.MappingAuditableBeanWrapperFactory;
@@ -231,7 +230,6 @@ public DefaultFormattingConversionService defaultConversionService() {
231230
addFormatters(conversionService);
232231

233232
configurerDelegate.configureConversionService(conversionService);
234-
configureConversionService(conversionService);
235233

236234
return conversionService;
237235
}
@@ -246,7 +244,6 @@ public ValidatingRepositoryEventListener validatingRepositoryEventListener(
246244

247245
ValidatingRepositoryEventListener listener = new ValidatingRepositoryEventListener(entities);
248246
configurerDelegate.configureValidatingRepositoryEventListener(listener);
249-
configureValidatingRepositoryEventListener(listener);
250247

251248
return listener;
252249
}
@@ -276,7 +273,6 @@ public RepositoryRestConfiguration config() {
276273
RepositoryRestConfiguration config = new RepositoryRestConfiguration(configuration, metadataConfiguration(),
277274
enumTranslator());
278275
configurerDelegate.configureRepositoryRestConfiguration(config);
279-
configureRepositoryRestConfiguration(config);
280276

281277
return config;
282278
}
@@ -677,7 +673,6 @@ public ExceptionHandlerExceptionResolver exceptionHandlerExceptionResolver() {
677673
er.setMessageConverters(defaultMessageConverters());
678674

679675
configurerDelegate.configureExceptionHandlerExceptionResolver(er);
680-
configureExceptionHandlerExceptionResolver(er);
681676

682677
return er;
683678
}
@@ -718,7 +713,6 @@ public List<HttpMessageConverter<?>> defaultMessageConverters() {
718713
messageConverters.add(uriListHttpMessageConverter());
719714

720715
configurerDelegate.configureHttpMessageConverters(messageConverters);
721-
configureHttpMessageConverters(messageConverters);
722716

723717
return messageConverters;
724718
}
@@ -843,7 +837,6 @@ protected ObjectMapper basicObjectMapper() {
843837
Jackson2DatatypeHelper.configureObjectMapper(objectMapper);
844838
// Configure custom Modules
845839
configurerDelegate.configureJacksonObjectMapper(objectMapper);
846-
configureJacksonObjectMapper(objectMapper);
847840

848841
return objectMapper;
849842
}
@@ -938,70 +931,4 @@ public int getOrder() {
938931
return order;
939932
}
940933
}
941-
942-
/**
943-
* Override this method to add additional configuration.
944-
*
945-
* @param config Main configuration bean.
946-
* @deprecated since 2.4, implement
947-
* {@link RepositoryRestConfigurer#configureRepositoryRestConfiguration(RepositoryRestConfiguration)}
948-
* either directly or extend {@link RepositoryRestConfigurerAdapter} and override the method.
949-
*/
950-
@Deprecated
951-
protected void configureRepositoryRestConfiguration(RepositoryRestConfiguration config) {}
952-
953-
/**
954-
* Override this method to add your own converters.
955-
*
956-
* @param conversionService Default ConversionService bean.
957-
* @deprecated since 2.4, implement
958-
* {@link RepositoryRestConfigurer#configureConversionService(ConfigurableConversionService)} either
959-
* directly or extend {@link RepositoryRestConfigurerAdapter} and override the method.
960-
*/
961-
@Deprecated
962-
protected void configureConversionService(ConfigurableConversionService conversionService) {}
963-
964-
/**
965-
* Override this method to add validators manually.
966-
*
967-
* @param validatingListener The {@link org.springframework.context.ApplicationListener} responsible for invoking
968-
* {@link org.springframework.validation.Validator} instances.
969-
* @deprecated since 2.4, implement
970-
* {@link RepositoryRestConfigurer#configureValidatingRepositoryEventListener(ValidatingRepositoryEventListener)}
971-
* either directly or extend {@link RepositoryRestConfigurerAdapter} and override the method.
972-
*/
973-
@Deprecated
974-
protected void configureValidatingRepositoryEventListener(ValidatingRepositoryEventListener validatingListener) {}
975-
976-
/**
977-
* Configure the {@link ExceptionHandlerExceptionResolver}.
978-
*
979-
* @param exceptionResolver The default exception resolver on which you can add custom argument resolvers.
980-
* @deprecated since 2.4, implement
981-
* {@link RepositoryRestConfigurer#configureExceptionHandlerExceptionResolver(ExceptionHandlerExceptionResolver)}
982-
* either directly or extend {@link RepositoryRestConfigurerAdapter} and override the method.
983-
*/
984-
@Deprecated
985-
protected void configureExceptionHandlerExceptionResolver(ExceptionHandlerExceptionResolver exceptionResolver) {}
986-
987-
/**
988-
* Configure the available {@link HttpMessageConverter}s by adding your own.
989-
*
990-
* @param messageConverters The converters to be used by the system.
991-
* @deprecated since 2.4, implement {@link RepositoryRestConfigurer#configureHttpMessageConverters(List)} either
992-
* directly or extend {@link RepositoryRestConfigurerAdapter} and override the method.
993-
*/
994-
@Deprecated
995-
protected void configureHttpMessageConverters(List<HttpMessageConverter<?>> messageConverters) {}
996-
997-
/**
998-
* Configure the Jackson {@link ObjectMapper} directly.
999-
*
1000-
* @param objectMapper The {@literal ObjectMapper} to be used by the system.
1001-
* @deprecated since 2.4, implement {@link RepositoryRestConfigurer#configureJacksonObjectMapper(ObjectMapper)} either
1002-
* directly or extend {@link RepositoryRestConfigurerAdapter} and override the method.
1003-
*/
1004-
@Deprecated
1005-
protected void configureJacksonObjectMapper(ObjectMapper objectMapper) {}
1006-
1007934
}

0 commit comments

Comments
 (0)