From c78973e3758d490d844c9eaa7fece65a1d69c108 Mon Sep 17 00:00:00 2001 From: Dave Syer Date: Sun, 15 Dec 2013 13:33:50 +0000 Subject: [PATCH] MessageConverters -> HttpMessageConverters --- docs/howto.md | 8 ++++---- .../autoconfigure/EndpointWebMvcAutoConfiguration.java | 4 ++-- ...{MessageConverters.java => HttpMessageConverters.java} | 6 +++--- .../boot/autoconfigure/web/WebMvcAutoConfiguration.java | 6 +++--- ...nvertersTests.java => HttpMessageConvertersTests.java} | 8 ++++---- .../autoconfigure/web/WebMvcAutoConfigurationTests.java | 2 +- 6 files changed, 17 insertions(+), 17 deletions(-) rename spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/web/{MessageConverters.java => HttpMessageConverters.java} (96%) rename spring-boot-autoconfigure/src/test/java/org/springframework/boot/autoconfigure/web/{MessageConvertersTests.java => HttpMessageConvertersTests.java} (87%) diff --git a/docs/howto.md b/docs/howto.md index 232e64edae..06d444956a 100644 --- a/docs/howto.md +++ b/docs/howto.md @@ -88,9 +88,9 @@ modules when you add new features to your application. Finally, if you provide any `@Beans` of type `MappingJackson2HttpMessageConverter` then they will replace the default value in the MVC configuration. Also, a convenience bean is -provided of type `MessageConverters` (always available if you use the -default MVC configuration) which has some useful methods to access the -default and user-enhanced message converters. +provided of type `HttpMessageConverters` (always available if you use +the default MVC configuration) which has some useful methods to access +the default and user-enhanced message converters. See also the [section on `HttpMessageConverters`](#message.converters) and the `WebMvcAutoConfiguration` source code for more details. @@ -104,7 +104,7 @@ converters by simply adding beans of that type in a Spring Boot context. If a bean you add is of a type that would have been included by default anyway (like `MappingJackson2HttpMessageConverter` for JSON conversions) then it will replace the default value. A convenience -bean is provided of type `MessageConverters` (always available if you +bean is provided of type `HttpMessageConverters` (always available if you use the default MVC configuration) which has some useful methods to access the default and user-enhanced message converters (useful, for example if you want to manually inject them into a custom diff --git a/spring-boot-actuator/src/main/java/org/springframework/boot/actuate/autoconfigure/EndpointWebMvcAutoConfiguration.java b/spring-boot-actuator/src/main/java/org/springframework/boot/actuate/autoconfigure/EndpointWebMvcAutoConfiguration.java index e4e0d3c334..e009793f77 100644 --- a/spring-boot-actuator/src/main/java/org/springframework/boot/actuate/autoconfigure/EndpointWebMvcAutoConfiguration.java +++ b/spring-boot-actuator/src/main/java/org/springframework/boot/actuate/autoconfigure/EndpointWebMvcAutoConfiguration.java @@ -40,7 +40,7 @@ import org.springframework.boot.autoconfigure.condition.ConditionalOnMissingBean import org.springframework.boot.autoconfigure.condition.ConditionalOnWebApplication; import org.springframework.boot.autoconfigure.web.DispatcherServletAutoConfiguration; import org.springframework.boot.autoconfigure.web.EmbeddedServletContainerAutoConfiguration; -import org.springframework.boot.autoconfigure.web.MessageConverters; +import org.springframework.boot.autoconfigure.web.HttpMessageConverters; import org.springframework.boot.autoconfigure.web.ServerProperties; import org.springframework.boot.autoconfigure.web.WebMvcAutoConfiguration; import org.springframework.boot.context.embedded.AnnotationConfigEmbeddedWebApplicationContext; @@ -94,7 +94,7 @@ public class EndpointWebMvcAutoConfiguration implements ApplicationContextAware, @Bean @ConditionalOnMissingBean public EndpointHandlerAdapter endpointHandlerAdapter( - final MessageConverters messageConverters) { + final HttpMessageConverters messageConverters) { EndpointHandlerAdapter adapter = new EndpointHandlerAdapter(); adapter.setMessageConverters(messageConverters.getMessageConverters()); return adapter; diff --git a/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/web/MessageConverters.java b/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/web/HttpMessageConverters.java similarity index 96% rename from spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/web/MessageConverters.java rename to spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/web/HttpMessageConverters.java index 955591bfc7..275e8f0486 100644 --- a/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/web/MessageConverters.java +++ b/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/web/HttpMessageConverters.java @@ -33,7 +33,7 @@ import org.springframework.web.servlet.config.annotation.WebMvcConfigurationSupp * * @author Dave Syer */ -public class MessageConverters { +public class HttpMessageConverters { private List> defaults; @@ -43,11 +43,11 @@ public class MessageConverters { private List> converters; - public MessageConverters() { + public HttpMessageConverters() { this(Collections.> emptyList()); } - public MessageConverters(Collection> overrides) { + public HttpMessageConverters(Collection> overrides) { this.overrides = new ArrayList>(overrides); } diff --git a/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/web/WebMvcAutoConfiguration.java b/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/web/WebMvcAutoConfiguration.java index 98c5b51944..cba287676a 100644 --- a/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/web/WebMvcAutoConfiguration.java +++ b/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/web/WebMvcAutoConfiguration.java @@ -116,10 +116,10 @@ public class WebMvcAutoConfiguration { @Bean @ConditionalOnMissingBean - public MessageConverters messageConverters() { + public HttpMessageConverters messageConverters() { List> converters = new ArrayList>( this.converters); - return new MessageConverters(converters); + return new HttpMessageConverters(converters); } @Bean @@ -148,7 +148,7 @@ public class WebMvcAutoConfiguration { private ResourceLoader resourceLoader; @Autowired - private MessageConverters messageConverters; + private HttpMessageConverters messageConverters; @Override public void configureMessageConverters(List> converters) { diff --git a/spring-boot-autoconfigure/src/test/java/org/springframework/boot/autoconfigure/web/MessageConvertersTests.java b/spring-boot-autoconfigure/src/test/java/org/springframework/boot/autoconfigure/web/HttpMessageConvertersTests.java similarity index 87% rename from spring-boot-autoconfigure/src/test/java/org/springframework/boot/autoconfigure/web/MessageConvertersTests.java rename to spring-boot-autoconfigure/src/test/java/org/springframework/boot/autoconfigure/web/HttpMessageConvertersTests.java index f61faa68b9..2c760c630f 100644 --- a/spring-boot-autoconfigure/src/test/java/org/springframework/boot/autoconfigure/web/MessageConvertersTests.java +++ b/spring-boot-autoconfigure/src/test/java/org/springframework/boot/autoconfigure/web/HttpMessageConvertersTests.java @@ -30,18 +30,18 @@ import static org.junit.Assert.assertTrue; /** * @author Dave Syer */ -public class MessageConvertersTests { +public class HttpMessageConvertersTests { @Test public void defaultsCreated() { - MessageConverters messageConverters = new MessageConverters(); + HttpMessageConverters messageConverters = new HttpMessageConverters(); assertFalse(messageConverters.getDefaultMessageConverters().isEmpty()); } @Test public void overrideExistingConverter() { MappingJackson2HttpMessageConverter converter = new MappingJackson2HttpMessageConverter(); - MessageConverters messageConverters = new MessageConverters( + HttpMessageConverters messageConverters = new HttpMessageConverters( Arrays.> asList(converter)); assertTrue(messageConverters.getMessageConverters().contains(converter)); } @@ -49,7 +49,7 @@ public class MessageConvertersTests { @Test public void addNewOne() { HttpMessageConverter converter = Mockito.mock(HttpMessageConverter.class); - MessageConverters messageConverters = new MessageConverters( + HttpMessageConverters messageConverters = new HttpMessageConverters( Arrays.> asList(converter)); assertTrue(messageConverters.getMessageConverters().contains(converter)); assertEquals(converter, messageConverters.getMessageConverters().get(0)); diff --git a/spring-boot-autoconfigure/src/test/java/org/springframework/boot/autoconfigure/web/WebMvcAutoConfigurationTests.java b/spring-boot-autoconfigure/src/test/java/org/springframework/boot/autoconfigure/web/WebMvcAutoConfigurationTests.java index 4f6a03635c..4ea3868e6d 100644 --- a/spring-boot-autoconfigure/src/test/java/org/springframework/boot/autoconfigure/web/WebMvcAutoConfigurationTests.java +++ b/spring-boot-autoconfigure/src/test/java/org/springframework/boot/autoconfigure/web/WebMvcAutoConfigurationTests.java @@ -153,7 +153,7 @@ public class WebMvcAutoConfigurationTests { .getBean(MappingJackson2HttpMessageConverter.class); assertEquals(this.context.getBean(ObjectMapper.class), converter.getObjectMapper()); - MessageConverters converters = this.context.getBean(MessageConverters.class); + HttpMessageConverters converters = this.context.getBean(HttpMessageConverters.class); assertTrue(converters.getMessageConverters().contains(converter)); assertEquals(converters.getMessageConverters(), this.context.getBean(RequestMappingHandlerAdapter.class)