From bcd74bb72d27daf42cc44e8952381f6c6621f468 Mon Sep 17 00:00:00 2001 From: Phillip Webb Date: Mon, 27 Jan 2014 14:58:47 -0800 Subject: [PATCH] Remove custom JodaModule support Remove the custom JodaModule support which is not necessary with Spring 4.0.1. Fixes gh-186 --- .../HttpMessageConvertersAutoConfiguration.java | 15 +-------------- ...tpMessageConvertersAutoConfigurationTests.java | 9 ++++++--- 2 files changed, 7 insertions(+), 17 deletions(-) diff --git a/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/web/HttpMessageConvertersAutoConfiguration.java b/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/web/HttpMessageConvertersAutoConfiguration.java index 591436fa40..0e6f4bed4a 100644 --- a/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/web/HttpMessageConvertersAutoConfiguration.java +++ b/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/web/HttpMessageConvertersAutoConfiguration.java @@ -1,5 +1,5 @@ /* - * Copyright 2012-2013 the original author or authors. + * Copyright 2012-2014 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. @@ -23,7 +23,6 @@ import java.util.List; import javax.annotation.PostConstruct; -import org.joda.time.DateTime; import org.springframework.beans.factory.BeanFactoryUtils; import org.springframework.beans.factory.ListableBeanFactory; import org.springframework.beans.factory.annotation.Autowired; @@ -38,7 +37,6 @@ import org.springframework.http.converter.json.MappingJackson2HttpMessageConvert import com.fasterxml.jackson.databind.Module; import com.fasterxml.jackson.databind.ObjectMapper; -import com.fasterxml.jackson.datatype.joda.JodaModule; /** * {@link EnableAutoConfiguration Auto-configuration} for {@link HttpMessageConverter}s. @@ -60,17 +58,6 @@ public class HttpMessageConvertersAutoConfiguration { return new HttpMessageConverters(converters); } - @Configuration - @ConditionalOnClass({ JodaModule.class, DateTime.class }) - protected static class JodaModuleConfiguration { - - @Bean - public JodaModule jodaModule() { - return new JodaModule(); - } - - } - @Configuration @ConditionalOnClass(ObjectMapper.class) protected static class ObjectMappers { diff --git a/spring-boot-autoconfigure/src/test/java/org/springframework/boot/autoconfigure/web/HttpMessageConvertersAutoConfigurationTests.java b/spring-boot-autoconfigure/src/test/java/org/springframework/boot/autoconfigure/web/HttpMessageConvertersAutoConfigurationTests.java index ffd7f35ff8..b050baf773 100644 --- a/spring-boot-autoconfigure/src/test/java/org/springframework/boot/autoconfigure/web/HttpMessageConvertersAutoConfigurationTests.java +++ b/spring-boot-autoconfigure/src/test/java/org/springframework/boot/autoconfigure/web/HttpMessageConvertersAutoConfigurationTests.java @@ -1,5 +1,5 @@ /* - * Copyright 2012-2013 the original author or authors. + * Copyright 2012-2014 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. @@ -18,6 +18,7 @@ package org.springframework.boot.autoconfigure.web; import java.io.IOException; +import org.joda.time.LocalDateTime; import org.junit.After; import org.junit.Test; import org.mockito.Mockito; @@ -35,9 +36,10 @@ import com.fasterxml.jackson.databind.ObjectMapper; import com.fasterxml.jackson.databind.SerializerProvider; import com.fasterxml.jackson.databind.module.SimpleModule; +import static org.hamcrest.Matchers.equalTo; import static org.hamcrest.Matchers.hasItem; import static org.junit.Assert.assertEquals; -import static org.junit.Assert.assertNotNull; +import static org.junit.Assert.assertThat; import static org.junit.Assert.assertTrue; import static org.mockito.Matchers.argThat; import static org.mockito.Mockito.verify; @@ -78,7 +80,8 @@ public class HttpMessageConvertersAutoConfigurationTests { this.context = new AnnotationConfigApplicationContext(); this.context.register(HttpMessageConvertersAutoConfiguration.class); this.context.refresh(); - assertNotNull(this.context.getBean("jodaModule", Module.class)); + ObjectMapper objectMapper = this.context.getBean(ObjectMapper.class); + assertThat(objectMapper.canSerialize(LocalDateTime.class), equalTo(true)); } @Test