Remove custom JodaModule support

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

Fixes gh-186
This commit is contained in:
Phillip Webb 2014-01-27 14:58:47 -08:00
parent ac0ff3c0b8
commit bcd74bb72d
2 changed files with 7 additions and 17 deletions

View File

@ -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 {

View File

@ -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