mirror of
https://github.com/spring-projects/spring-framework.git
synced 2026-09-25 16:29:28 +00:00
Allow null ObjectMapper in Jackson2ObjectMapperFactoryBean.getObjectType()
Issue: SPR-11785
This commit is contained in:
+1
-2
@@ -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
|
||||
|
||||
+5
@@ -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();
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user