org.springframework.http.converter.json

## Class SpringHandlerInstantiator

- java.lang.Object
- - com.fasterxml.jackson.databind.cfg.HandlerInstantiator
  - - org.springframework.http.converter.json.SpringHandlerInstantiator

-     public class SpringHandlerInstantiator
      extends HandlerInstantiator

  Allows for creating Jackson (`JsonSerializer`, `JsonDeserializer`, `KeyDeserializer`, `TypeResolverBuilder`, `TypeIdResolver`) beans with autowiring against a Spring `ApplicationContext`.

  As of Spring 4.3, this overrides all factory methods in `HandlerInstantiator`, including non-abstract ones and recently introduced ones from Jackson 2.4 and 2.5: for `ValueInstantiator`, `ObjectIdGenerator`, `ObjectIdResolver`, `PropertyNamingStrategy`, `Converter`, `VirtualBeanPropertyWriter`.

  Since:
    4.1.3
  Author:
    Sebastien Deleuze, Juergen Hoeller
  See Also:
    `Jackson2ObjectMapperBuilder.handlerInstantiator(HandlerInstantiator)`, `ApplicationContext.getAutowireCapableBeanFactory()`, `HandlerInstantiator`

- - ### Constructor Summary

    Constructors
    Constructor and Description
    `SpringHandlerInstantiator(AutowireCapableBeanFactory beanFactory)` Create a new SpringHandlerInstantiator for the given BeanFactory.

  - ### Method Summary

    All Methods Instance Methods Concrete Methods
    Modifier and Type | Method and Description
    --- | ---
    `Converter<?,?>` | `converterInstance(MapperConfig<?> config, Annotated annotated, Class<?> implClass)`
    `JsonDeserializer<?>` | `deserializerInstance(DeserializationConfig config, Annotated annotated, Class<?> implClass)`
    `KeyDeserializer` | `keyDeserializerInstance(DeserializationConfig config, Annotated annotated, Class<?> implClass)`
    `PropertyNamingStrategy` | `namingStrategyInstance(MapperConfig<?> config, Annotated annotated, Class<?> implClass)`
    `com.fasterxml.jackson.annotation.ObjectIdGenerator<?>` | `objectIdGeneratorInstance(MapperConfig<?> config, Annotated annotated, Class<?> implClass)`
    `com.fasterxml.jackson.annotation.ObjectIdResolver` | `resolverIdGeneratorInstance(MapperConfig<?> config, Annotated annotated, Class<?> implClass)`
    `JsonSerializer<?>` | `serializerInstance(SerializationConfig config, Annotated annotated, Class<?> implClass)`
    `TypeIdResolver` | `typeIdResolverInstance(MapperConfig<?> config, Annotated annotated, Class<?> implClass)`
    `TypeResolverBuilder<?>` | `typeResolverBuilderInstance(MapperConfig<?> config, Annotated annotated, Class<?> implClass)`
    `ValueInstantiator` | `valueInstantiatorInstance(MapperConfig<?> config, Annotated annotated, Class<?> implClass)`
    `VirtualBeanPropertyWriter` | `virtualPropertyWriterInstance(MapperConfig<?> config, Class<?> implClass)`

    - ### Methods inherited from class com.fasterxml.jackson.databind.cfg.HandlerInstantiator

      `includeFilterInstance`

    - ### Methods inherited from class java.lang.Object

      `clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

- - ### Constructor Detail

    - #### SpringHandlerInstantiator

          public SpringHandlerInstantiator(AutowireCapableBeanFactory beanFactory)

      Create a new SpringHandlerInstantiator for the given BeanFactory.
      Parameters:
        `beanFactory` - the target BeanFactory

  - ### Method Detail

    - #### deserializerInstance

          public JsonDeserializer<?> deserializerInstance(DeserializationConfig config,
                                                          Annotated annotated,
                                                          Class<?> implClass)

      Specified by:
        `deserializerInstance` in class `HandlerInstantiator`

    - #### keyDeserializerInstance

          public KeyDeserializer keyDeserializerInstance(DeserializationConfig config,
                                                         Annotated annotated,
                                                         Class<?> implClass)

      Specified by:
        `keyDeserializerInstance` in class `HandlerInstantiator`

    - #### serializerInstance

          public JsonSerializer<?> serializerInstance(SerializationConfig config,
                                                      Annotated annotated,
                                                      Class<?> implClass)

      Specified by:
        `serializerInstance` in class `HandlerInstantiator`

    - #### typeResolverBuilderInstance

          public TypeResolverBuilder<?> typeResolverBuilderInstance(MapperConfig<?> config,
                                                                    Annotated annotated,
                                                                    Class<?> implClass)

      Specified by:
        `typeResolverBuilderInstance` in class `HandlerInstantiator`

    - #### typeIdResolverInstance

          public TypeIdResolver typeIdResolverInstance(MapperConfig<?> config,
                                                       Annotated annotated,
                                                       Class<?> implClass)

      Specified by:
        `typeIdResolverInstance` in class `HandlerInstantiator`

    - #### valueInstantiatorInstance

          public ValueInstantiator valueInstantiatorInstance(MapperConfig<?> config,
                                                             Annotated annotated,
                                                             Class<?> implClass)

      Overrides:
        `valueInstantiatorInstance` in class `HandlerInstantiator`
      Since:
        4.3

    - #### objectIdGeneratorInstance

          public com.fasterxml.jackson.annotation.ObjectIdGenerator<?> objectIdGeneratorInstance(MapperConfig<?> config,
                                                                                                 Annotated annotated,
                                                                                                 Class<?> implClass)

      Overrides:
        `objectIdGeneratorInstance` in class `HandlerInstantiator`
      Since:
        4.3

    - #### resolverIdGeneratorInstance

          public com.fasterxml.jackson.annotation.ObjectIdResolver resolverIdGeneratorInstance(MapperConfig<?> config,
                                                                                               Annotated annotated,
                                                                                               Class<?> implClass)

      Overrides:
        `resolverIdGeneratorInstance` in class `HandlerInstantiator`
      Since:
        4.3

    - #### namingStrategyInstance

          public PropertyNamingStrategy namingStrategyInstance(MapperConfig<?> config,
                                                               Annotated annotated,
                                                               Class<?> implClass)

      Overrides:
        `namingStrategyInstance` in class `HandlerInstantiator`
      Since:
        4.3

    - #### converterInstance

          public Converter<?,?> converterInstance(MapperConfig<?> config,
                                                  Annotated annotated,
                                                  Class<?> implClass)

      Overrides:
        `converterInstance` in class `HandlerInstantiator`
      Since:
        4.3

    - #### virtualPropertyWriterInstance

          public VirtualBeanPropertyWriter virtualPropertyWriterInstance(MapperConfig<?> config,
                                                                         Class<?> implClass)

      Overrides:
        `virtualPropertyWriterInstance` in class `HandlerInstantiator`
      Since:
        4.3