diff --git a/spring-web/src/main/java/org/springframework/http/converter/json/Jackson2ObjectMapperFactoryBean.java b/spring-web/src/main/java/org/springframework/http/converter/json/Jackson2ObjectMapperFactoryBean.java index 506511694d..55643fbdcc 100644 --- a/spring-web/src/main/java/org/springframework/http/converter/json/Jackson2ObjectMapperFactoryBean.java +++ b/spring-web/src/main/java/org/springframework/http/converter/json/Jackson2ObjectMapperFactoryBean.java @@ -55,7 +55,7 @@ import org.springframework.util.ClassUtils; *
* <bean class="org.springframework.http.converter.json.MappingJackson2HttpMessageConverter"> * <property name="objectMapper"> - * <bean class="org.springframework.web.context.support.Jackson2ObjectMapperFactoryBean" + * <bean class="org.springframework.http.converter.json.Jackson2ObjectMapperFactoryBean" * p:autoDetectFields="false" * p:autoDetectGettersSetters="false" * p:annotationIntrospector-ref="jaxbAnnotationIntrospector" /> @@ -68,7 +68,7 @@ import org.springframework.util.ClassUtils; ** <bean class="org.springframework.web.servlet.view.json.MappingJackson2JsonView"> * <property name="objectMapper"> - * <bean class="org.springframework.web.context.support.Jackson2ObjectMapperFactoryBean" + * <bean class="org.springframework.http.converter.json.Jackson2ObjectMapperFactoryBean" * p:failOnEmptyBeans="false" * p:indentOutput="true"> * <property name="serializers"> @@ -81,12 +81,12 @@ import org.springframework.util.ClassUtils; * </bean> ** - *In case there are no specific setters provided (for some rarely used - * options), you can still use the more general methods - * {@link #setFeaturesToEnable(Object[])} and {@link #setFeaturesToDisable(Object[])}. + *
In case there are no specific setters provided (for some rarely used options), + * you can still use the more general methods {@link #setFeaturesToEnable} and + * {@link #setFeaturesToDisable}. * *
- * <bean class="org.springframework.web.context.support.Jackson2ObjectMapperFactoryBean"> + * <bean class="org.springframework.http.converter.json.Jackson2ObjectMapperFactoryBean"> * <property name="featuresToEnable"> * <array> * <util:constant static-field="com.fasterxml.jackson.databind.SerializationFeature$WRAP_ROOT_VALUE"/> @@ -101,19 +101,18 @@ import org.springframework.util.ClassUtils; * </bean> ** - * In case you want to configure Jackson's {@link ObjectMapper} with a {@link Module}, you - * can register Modules using {@link #setModules(java.util.List)} + *In case you want to configure Jackson's {@link ObjectMapper} with a custom {@link Module}, + * you can register one or more such Modules by class name via {@link #setModulesToInstall}: * *
- * <bean class="org.springframework.web.context.support.Jackson2ObjectMapperFactoryBean"> - * <property name="modules"> - * <list> - * <bean class="org.example.jackson.module.MySampleModule"/> - * </list> - * </property> - * </bean> + * <bean class="org.springframework.http.converter.json.Jackson2ObjectMapperFactoryBean"> + * <property name="modulesToInstall" value="myapp.jackson.MySampleModule,myapp.jackson.MyOtherModule"/> + * </bean ** + * Note that Jackson's JSR-310 and Joda-Time support modules will be registered automatically + * when available (and when Java 8 and Joda-Time themselves are available, respectively). + * *Tested against Jackson 2.2 and 2.3; compatible with Jackson 2.0 and higher. * * @author Dmitry Katsubo