use of org.springframework.http.converter.json.Jackson2ObjectMapperFactoryBean in project pinpoint by naver.
the class ServerInstanceListSerializerTest method createMapper.
private ObjectMapper createMapper() {
final Jackson2ObjectMapperFactoryBean factoryBean = new Jackson2ObjectMapperFactoryBean();
factoryBean.setHandlerInstantiator(new TestHandlerInstantiator());
// TODO FIX spring managed object
factoryBean.afterPropertiesSet();
return factoryBean.getObject();
}
use of org.springframework.http.converter.json.Jackson2ObjectMapperFactoryBean in project geode by apache.
the class RestInterfaceJUnitTest method getObjectMapper.
protected ObjectMapper getObjectMapper() {
if (objectMapper == null) {
Jackson2ObjectMapperFactoryBean objectMapperFactoryBean = new Jackson2ObjectMapperFactoryBean();
objectMapperFactoryBean.setFailOnEmptyBeans(true);
objectMapperFactoryBean.setFeaturesToEnable(Feature.ALLOW_COMMENTS);
objectMapperFactoryBean.setFeaturesToEnable(Feature.ALLOW_SINGLE_QUOTES);
objectMapperFactoryBean.setFeaturesToEnable(DeserializationFeature.ACCEPT_EMPTY_STRING_AS_NULL_OBJECT);
objectMapperFactoryBean.setFeaturesToDisable(DeserializationFeature.FAIL_ON_UNKNOWN_PROPERTIES);
objectMapperFactoryBean.setIndentOutput(true);
objectMapperFactoryBean.setSimpleDateFormat("MM/dd/yyyy");
objectMapperFactoryBean.afterPropertiesSet();
objectMapper = objectMapperFactoryBean.getObject();
}
return objectMapper;
}
use of org.springframework.http.converter.json.Jackson2ObjectMapperFactoryBean in project geode by apache.
the class RestTestUtils method createMappingJackson2HttpMessageConverter.
public static HttpMessageConverter<Object> createMappingJackson2HttpMessageConverter() {
final Jackson2ObjectMapperFactoryBean objectMapperFactoryBean = new Jackson2ObjectMapperFactoryBean();
objectMapperFactoryBean.setFailOnEmptyBeans(true);
objectMapperFactoryBean.setIndentOutput(true);
objectMapperFactoryBean.setDateFormat(new SimpleDateFormat("MM/dd/yyyy"));
objectMapperFactoryBean.setFeaturesToDisable(com.fasterxml.jackson.databind.DeserializationFeature.FAIL_ON_UNKNOWN_PROPERTIES);
objectMapperFactoryBean.setFeaturesToEnable(com.fasterxml.jackson.core.JsonParser.Feature.ALLOW_COMMENTS, com.fasterxml.jackson.core.JsonParser.Feature.ALLOW_SINGLE_QUOTES, com.fasterxml.jackson.databind.DeserializationFeature.ACCEPT_EMPTY_STRING_AS_NULL_OBJECT);
objectMapperFactoryBean.afterPropertiesSet();
final MappingJackson2HttpMessageConverter httpMessageConverter = new MappingJackson2HttpMessageConverter();
httpMessageConverter.setObjectMapper(objectMapperFactoryBean.getObject());
return httpMessageConverter;
}
Aggregations