Allow null ObjectMapper in Jackson2ObjectMapperFactoryBean.getObjectType()
Issue: SPR-11785
This commit is contained in:
parent
181299cc6c
commit
ebc726a915
|
|
@ -486,8 +486,7 @@ public class Jackson2ObjectMapperFactoryBean implements FactoryBean<ObjectMapper
|
|||
|
||||
@Override
|
||||
public Class<?> getObjectType() {
|
||||
Assert.notNull(this.objectMapper, "ObjectMapper must not be null");
|
||||
return this.objectMapper.getClass();
|
||||
return (this.objectMapper != null) ? this.objectMapper.getClass() : null;
|
||||
}
|
||||
|
||||
@Override
|
||||
|
|
|
|||
|
|
@ -182,6 +182,11 @@ public class Jackson2ObjectMapperFactoryBeanTests {
|
|||
assertEquals(ObjectMapper.class, this.factory.getObjectType());
|
||||
}
|
||||
|
||||
@Test
|
||||
public void undefinedObjectType() {
|
||||
assertEquals(null, this.factory.getObjectType());
|
||||
}
|
||||
|
||||
private static SerializerFactoryConfig getSerializerFactoryConfig(ObjectMapper objectMapper) {
|
||||
return ((BasicSerializerFactory) objectMapper.getSerializerFactory()).getFactoryConfig();
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in New Issue