|
|
|
@ -36,6 +36,7 @@ import com.fasterxml.jackson.databind.ObjectMapper; |
|
|
|
import com.fasterxml.jackson.databind.PropertyNamingStrategy; |
|
|
|
import com.fasterxml.jackson.databind.PropertyNamingStrategy; |
|
|
|
import com.fasterxml.jackson.databind.SerializationFeature; |
|
|
|
import com.fasterxml.jackson.databind.SerializationFeature; |
|
|
|
import com.fasterxml.jackson.databind.cfg.HandlerInstantiator; |
|
|
|
import com.fasterxml.jackson.databind.cfg.HandlerInstantiator; |
|
|
|
|
|
|
|
import com.fasterxml.jackson.databind.jsontype.TypeResolverBuilder; |
|
|
|
import com.fasterxml.jackson.databind.ser.FilterProvider; |
|
|
|
import com.fasterxml.jackson.databind.ser.FilterProvider; |
|
|
|
import com.fasterxml.jackson.dataformat.xml.XmlMapper; |
|
|
|
import com.fasterxml.jackson.dataformat.xml.XmlMapper; |
|
|
|
|
|
|
|
|
|
|
|
@ -215,6 +216,14 @@ public class Jackson2ObjectMapperFactoryBean implements FactoryBean<ObjectMapper |
|
|
|
this.builder.propertyNamingStrategy(propertyNamingStrategy); |
|
|
|
this.builder.propertyNamingStrategy(propertyNamingStrategy); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/** |
|
|
|
|
|
|
|
* Specify a {@link TypeResolverBuilder} to use for Jackson's default typing. |
|
|
|
|
|
|
|
* @since 4.2.2 |
|
|
|
|
|
|
|
*/ |
|
|
|
|
|
|
|
public void setDefaultTyping(TypeResolverBuilder<?> typeResolverBuilder) { |
|
|
|
|
|
|
|
this.builder.defaultTyping(typeResolverBuilder); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
/** |
|
|
|
/** |
|
|
|
* Set a custom inclusion strategy for serialization. |
|
|
|
* Set a custom inclusion strategy for serialization. |
|
|
|
* @see com.fasterxml.jackson.annotation.JsonInclude.Include |
|
|
|
* @see com.fasterxml.jackson.annotation.JsonInclude.Include |
|
|
|
@ -223,6 +232,27 @@ public class Jackson2ObjectMapperFactoryBean implements FactoryBean<ObjectMapper |
|
|
|
this.builder.serializationInclusion(serializationInclusion); |
|
|
|
this.builder.serializationInclusion(serializationInclusion); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/** |
|
|
|
|
|
|
|
* Set the global filters to use in order to support {@link JsonFilter @JsonFilter} annotated POJO. |
|
|
|
|
|
|
|
* @since 4.2 |
|
|
|
|
|
|
|
* @see Jackson2ObjectMapperBuilder#filters(FilterProvider) |
|
|
|
|
|
|
|
*/ |
|
|
|
|
|
|
|
public void setFilters(FilterProvider filters) { |
|
|
|
|
|
|
|
this.builder.filters(filters); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/** |
|
|
|
|
|
|
|
* Add mix-in annotations to use for augmenting specified class or interface. |
|
|
|
|
|
|
|
* @param mixIns Map of entries with target classes (or interface) whose annotations |
|
|
|
|
|
|
|
* to effectively override as key and mix-in classes (or interface) whose |
|
|
|
|
|
|
|
* annotations are to be "added" to target's annotations as value. |
|
|
|
|
|
|
|
* @since 4.1.2 |
|
|
|
|
|
|
|
* @see com.fasterxml.jackson.databind.ObjectMapper#addMixInAnnotations(Class, Class) |
|
|
|
|
|
|
|
*/ |
|
|
|
|
|
|
|
public void setMixIns(Map<Class<?>, Class<?>> mixIns) { |
|
|
|
|
|
|
|
this.builder.mixIns(mixIns); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
/** |
|
|
|
/** |
|
|
|
* Configure custom serializers. Each serializer is registered for the type |
|
|
|
* Configure custom serializers. Each serializer is registered for the type |
|
|
|
* returned by {@link JsonSerializer#handledType()}, which must not be |
|
|
|
* returned by {@link JsonSerializer#handledType()}, which must not be |
|
|
|
@ -248,18 +278,6 @@ public class Jackson2ObjectMapperFactoryBean implements FactoryBean<ObjectMapper |
|
|
|
this.builder.deserializersByType(deserializers); |
|
|
|
this.builder.deserializersByType(deserializers); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
/** |
|
|
|
|
|
|
|
* Add mix-in annotations to use for augmenting specified class or interface. |
|
|
|
|
|
|
|
* @param mixIns Map of entries with target classes (or interface) whose annotations |
|
|
|
|
|
|
|
* to effectively override as key and mix-in classes (or interface) whose |
|
|
|
|
|
|
|
* annotations are to be "added" to target's annotations as value. |
|
|
|
|
|
|
|
* @since 4.1.2 |
|
|
|
|
|
|
|
* @see com.fasterxml.jackson.databind.ObjectMapper#addMixInAnnotations(Class, Class) |
|
|
|
|
|
|
|
*/ |
|
|
|
|
|
|
|
public void setMixIns(Map<Class<?>, Class<?>> mixIns) { |
|
|
|
|
|
|
|
this.builder.mixIns(mixIns); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/** |
|
|
|
/** |
|
|
|
* Shortcut for {@link MapperFeature#AUTO_DETECT_FIELDS} option. |
|
|
|
* Shortcut for {@link MapperFeature#AUTO_DETECT_FIELDS} option. |
|
|
|
*/ |
|
|
|
*/ |
|
|
|
@ -373,6 +391,11 @@ public class Jackson2ObjectMapperFactoryBean implements FactoryBean<ObjectMapper |
|
|
|
this.builder.findModulesViaServiceLoader(findModules); |
|
|
|
this.builder.findModulesViaServiceLoader(findModules); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
@Override |
|
|
|
|
|
|
|
public void setBeanClassLoader(ClassLoader beanClassLoader) { |
|
|
|
|
|
|
|
this.builder.moduleClassLoader(beanClassLoader); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
/** |
|
|
|
/** |
|
|
|
* Customize the construction of Jackson handlers ({@link JsonSerializer}, {@link JsonDeserializer}, |
|
|
|
* Customize the construction of Jackson handlers ({@link JsonSerializer}, {@link JsonDeserializer}, |
|
|
|
* {@link KeyDeserializer}, {@code TypeResolverBuilder} and {@code TypeIdResolver}). |
|
|
|
* {@link KeyDeserializer}, {@code TypeResolverBuilder} and {@code TypeIdResolver}). |
|
|
|
@ -384,17 +407,15 @@ public class Jackson2ObjectMapperFactoryBean implements FactoryBean<ObjectMapper |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
/** |
|
|
|
/** |
|
|
|
* Set the global filters to use in order to support {@link JsonFilter @JsonFilter} annotated POJO. |
|
|
|
* Set the builder {@link ApplicationContext} in order to autowire Jackson handlers ({@link JsonSerializer}, |
|
|
|
* @since 4.2 |
|
|
|
* {@link JsonDeserializer}, {@link KeyDeserializer}, {@code TypeResolverBuilder} and {@code TypeIdResolver}). |
|
|
|
* @see Jackson2ObjectMapperBuilder#filters(FilterProvider) |
|
|
|
* @since 4.1.3 |
|
|
|
|
|
|
|
* @see Jackson2ObjectMapperBuilder#applicationContext(ApplicationContext) |
|
|
|
|
|
|
|
* @see SpringHandlerInstantiator |
|
|
|
*/ |
|
|
|
*/ |
|
|
|
public void setFilters(FilterProvider filters) { |
|
|
|
|
|
|
|
this.builder.filters(filters); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
@Override |
|
|
|
@Override |
|
|
|
public void setBeanClassLoader(ClassLoader beanClassLoader) { |
|
|
|
public void setApplicationContext(ApplicationContext applicationContext) { |
|
|
|
this.builder.moduleClassLoader(beanClassLoader); |
|
|
|
this.builder.applicationContext(applicationContext); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
@ -408,18 +429,6 @@ public class Jackson2ObjectMapperFactoryBean implements FactoryBean<ObjectMapper |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
/** |
|
|
|
|
|
|
|
* Set the builder {@link ApplicationContext} in order to autowire Jackson handlers ({@link JsonSerializer}, |
|
|
|
|
|
|
|
* {@link JsonDeserializer}, {@link KeyDeserializer}, {@code TypeResolverBuilder} and {@code TypeIdResolver}). |
|
|
|
|
|
|
|
* @since 4.1.3 |
|
|
|
|
|
|
|
* @see Jackson2ObjectMapperBuilder#applicationContext(ApplicationContext) |
|
|
|
|
|
|
|
* @see SpringHandlerInstantiator |
|
|
|
|
|
|
|
*/ |
|
|
|
|
|
|
|
@Override |
|
|
|
|
|
|
|
public void setApplicationContext(ApplicationContext applicationContext) { |
|
|
|
|
|
|
|
this.builder.applicationContext(applicationContext); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/** |
|
|
|
/** |
|
|
|
* Return the singleton ObjectMapper. |
|
|
|
* Return the singleton ObjectMapper. |
|
|
|
*/ |
|
|
|
*/ |
|
|
|
|