Commit bcd74bb7 authored by Phillip Webb's avatar Phillip Webb

Remove custom JodaModule support

Remove the custom JodaModule support which is not necessary with
Spring 4.0.1.

Fixes gh-186
parent ac0ff3c0
/* /*
* 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"); * Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License. * you may not use this file except in compliance with the License.
...@@ -23,7 +23,6 @@ import java.util.List; ...@@ -23,7 +23,6 @@ import java.util.List;
import javax.annotation.PostConstruct; import javax.annotation.PostConstruct;
import org.joda.time.DateTime;
import org.springframework.beans.factory.BeanFactoryUtils; import org.springframework.beans.factory.BeanFactoryUtils;
import org.springframework.beans.factory.ListableBeanFactory; import org.springframework.beans.factory.ListableBeanFactory;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
...@@ -38,7 +37,6 @@ import org.springframework.http.converter.json.MappingJackson2HttpMessageConvert ...@@ -38,7 +37,6 @@ import org.springframework.http.converter.json.MappingJackson2HttpMessageConvert
import com.fasterxml.jackson.databind.Module; import com.fasterxml.jackson.databind.Module;
import com.fasterxml.jackson.databind.ObjectMapper; import com.fasterxml.jackson.databind.ObjectMapper;
import com.fasterxml.jackson.datatype.joda.JodaModule;
/** /**
* {@link EnableAutoConfiguration Auto-configuration} for {@link HttpMessageConverter}s. * {@link EnableAutoConfiguration Auto-configuration} for {@link HttpMessageConverter}s.
...@@ -60,17 +58,6 @@ public class HttpMessageConvertersAutoConfiguration { ...@@ -60,17 +58,6 @@ public class HttpMessageConvertersAutoConfiguration {
return new HttpMessageConverters(converters); return new HttpMessageConverters(converters);
} }
@Configuration
@ConditionalOnClass({ JodaModule.class, DateTime.class })
protected static class JodaModuleConfiguration {
@Bean
public JodaModule jodaModule() {
return new JodaModule();
}
}
@Configuration @Configuration
@ConditionalOnClass(ObjectMapper.class) @ConditionalOnClass(ObjectMapper.class)
protected static class ObjectMappers { protected static class ObjectMappers {
......
/* /*
* 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"); * Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License. * you may not use this file except in compliance with the License.
...@@ -18,6 +18,7 @@ package org.springframework.boot.autoconfigure.web; ...@@ -18,6 +18,7 @@ package org.springframework.boot.autoconfigure.web;
import java.io.IOException; import java.io.IOException;
import org.joda.time.LocalDateTime;
import org.junit.After; import org.junit.After;
import org.junit.Test; import org.junit.Test;
import org.mockito.Mockito; import org.mockito.Mockito;
...@@ -35,9 +36,10 @@ import com.fasterxml.jackson.databind.ObjectMapper; ...@@ -35,9 +36,10 @@ import com.fasterxml.jackson.databind.ObjectMapper;
import com.fasterxml.jackson.databind.SerializerProvider; import com.fasterxml.jackson.databind.SerializerProvider;
import com.fasterxml.jackson.databind.module.SimpleModule; import com.fasterxml.jackson.databind.module.SimpleModule;
import static org.hamcrest.Matchers.equalTo;
import static org.hamcrest.Matchers.hasItem; import static org.hamcrest.Matchers.hasItem;
import static org.junit.Assert.assertEquals; 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.junit.Assert.assertTrue;
import static org.mockito.Matchers.argThat; import static org.mockito.Matchers.argThat;
import static org.mockito.Mockito.verify; import static org.mockito.Mockito.verify;
...@@ -78,7 +80,8 @@ public class HttpMessageConvertersAutoConfigurationTests { ...@@ -78,7 +80,8 @@ public class HttpMessageConvertersAutoConfigurationTests {
this.context = new AnnotationConfigApplicationContext(); this.context = new AnnotationConfigApplicationContext();
this.context.register(HttpMessageConvertersAutoConfiguration.class); this.context.register(HttpMessageConvertersAutoConfiguration.class);
this.context.refresh(); 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 @Test
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment