|
62 | 62 | * <p>Example usage with
|
63 | 63 | * {@link MappingJackson2HttpMessageConverter}:
|
64 | 64 | *
|
65 |
| - * <pre class="code">{@code |
66 |
| - * <bean class="org.springframework.http.converter.json.MappingJackson2HttpMessageConverter"> |
67 |
| - * <property name="objectMapper"> |
68 |
| - * <bean class="org.springframework.http.converter.json.Jackson2ObjectMapperFactoryBean" |
| 65 | + * <pre class="code"> |
| 66 | + * <bean class="org.springframework.http.converter.json.MappingJackson2HttpMessageConverter"> |
| 67 | + * <property name="objectMapper"> |
| 68 | + * <bean class="org.springframework.http.converter.json.Jackson2ObjectMapperFactoryBean" |
69 | 69 | * p:autoDetectFields="false"
|
70 | 70 | * p:autoDetectGettersSetters="false"
|
71 |
| - * p:annotationIntrospector-ref="jaxbAnnotationIntrospector" /> |
72 |
| - * </property> |
73 |
| - * </bean> |
74 |
| - * }</pre> |
| 71 | + * p:annotationIntrospector-ref="jaxbAnnotationIntrospector" /> |
| 72 | + * </property> |
| 73 | + * </bean></pre> |
75 | 74 | *
|
76 | 75 | * <p>Example usage with MappingJackson2JsonView:
|
77 | 76 | *
|
78 |
| - * <pre class="code">{@code |
79 |
| - * <bean class="org.springframework.web.servlet.view.json.MappingJackson2JsonView"> |
80 |
| - * <property name="objectMapper"> |
81 |
| - * <bean class="org.springframework.http.converter.json.Jackson2ObjectMapperFactoryBean" |
| 77 | + * <pre class="code"> |
| 78 | + * <bean class="org.springframework.web.servlet.view.json.MappingJackson2JsonView"> |
| 79 | + * <property name="objectMapper"> |
| 80 | + * <bean class="org.springframework.http.converter.json.Jackson2ObjectMapperFactoryBean" |
82 | 81 | * p:failOnEmptyBeans="false"
|
83 |
| - * p:indentOutput="true"> |
84 |
| - * <property name="serializers"> |
85 |
| - * <array> |
86 |
| - * <bean class="org.mycompany.MyCustomSerializer" /> |
87 |
| - * </array> |
88 |
| - * </property> |
89 |
| - * </bean> |
90 |
| - * </property> |
91 |
| - * </bean> |
92 |
| - * }</pre> |
| 82 | + * p:indentOutput="true"> |
| 83 | + * <property name="serializers"> |
| 84 | + * <array> |
| 85 | + * <bean class="org.mycompany.MyCustomSerializer" /> |
| 86 | + * </array> |
| 87 | + * </property> |
| 88 | + * </bean> |
| 89 | + * </property> |
| 90 | + * </bean></pre> |
93 | 91 | *
|
94 | 92 | * <p>In case there are no specific setters provided (for some rarely used options),
|
95 | 93 | * you can still use the more general methods {@link #setFeaturesToEnable} and
|
96 | 94 | * {@link #setFeaturesToDisable}.
|
97 | 95 | *
|
98 |
| - * <pre class="code">{@code |
99 |
| - * <bean class="org.springframework.http.converter.json.Jackson2ObjectMapperFactoryBean"> |
100 |
| - * <property name="featuresToEnable"> |
101 |
| - * <array> |
102 |
| - * <util:constant static-field="com.fasterxml.jackson.databind.SerializationFeature.WRAP_ROOT_VALUE"/> |
103 |
| - * <util:constant static-field="com.fasterxml.jackson.databind.SerializationFeature.CLOSE_CLOSEABLE"/> |
104 |
| - * </array> |
105 |
| - * </property> |
106 |
| - * <property name="featuresToDisable"> |
107 |
| - * <array> |
108 |
| - * <util:constant static-field="com.fasterxml.jackson.databind.MapperFeature.USE_ANNOTATIONS"/> |
109 |
| - * </array> |
110 |
| - * </property> |
111 |
| - * </bean> |
112 |
| - * }</pre> |
| 96 | + * <pre class="code"> |
| 97 | + * <bean class="org.springframework.http.converter.json.Jackson2ObjectMapperFactoryBean"> |
| 98 | + * <property name="featuresToEnable"> |
| 99 | + * <array> |
| 100 | + * <util:constant static-field="com.fasterxml.jackson.databind.SerializationFeature.WRAP_ROOT_VALUE"/> |
| 101 | + * <util:constant static-field="com.fasterxml.jackson.databind.SerializationFeature.CLOSE_CLOSEABLE"/> |
| 102 | + * </array> |
| 103 | + * </property> |
| 104 | + * <property name="featuresToDisable"> |
| 105 | + * <array> |
| 106 | + * <util:constant static-field="com.fasterxml.jackson.databind.MapperFeature.USE_ANNOTATIONS"/> |
| 107 | + * </array> |
| 108 | + * </property> |
| 109 | + * </bean></pre> |
113 | 110 | *
|
114 | 111 | * <p>It also automatically registers the following well-known modules if they are
|
115 | 112 | * detected on the classpath:
|
|
120 | 117 | * support for other Java 8 types like {@link java.util.Optional}</li>
|
121 | 118 | * <li><a href="https://github.com/FasterXML/jackson-datatype-jsr310">jackson-datatype-jsr310</a>:
|
122 | 119 | * support for Java 8 Date & Time API types</li>
|
123 |
| - * <li><a href="https://github.com/FasterXML/jackson-datatype-joda">jackson-datatype-joda</a>: |
124 |
| - * support for Joda-Time types</li> |
125 | 120 | * <li><a href="https://github.com/FasterXML/jackson-module-kotlin">jackson-module-kotlin</a>:
|
126 | 121 | * support for Kotlin classes and data classes</li>
|
127 | 122 | * </ul>
|
128 | 123 | *
|
129 | 124 | * <p>In case you want to configure Jackson's {@link ObjectMapper} with a custom {@link Module},
|
130 | 125 | * you can register one or more such Modules by class name via {@link #setModulesToInstall}:
|
131 | 126 | *
|
132 |
| - * <pre class="code">{@code |
133 |
| - * <bean class="org.springframework.http.converter.json.Jackson2ObjectMapperFactoryBean"> |
134 |
| - * <property name="modulesToInstall" value="myapp.jackson.MySampleModule,myapp.jackson.MyOtherModule"/> |
135 |
| - * </bean |
136 |
| - * }</pre> |
| 127 | + * <pre class="code"> |
| 128 | + * <bean class="org.springframework.http.converter.json.Jackson2ObjectMapperFactoryBean"> |
| 129 | + * <property name="modulesToInstall" value="myapp.jackson.MySampleModule,myapp.jackson.MyOtherModule"/> |
| 130 | + * </bean></pre> |
137 | 131 | *
|
138 | 132 | * <p>Compatible with Jackson 2.9 to 2.12, as of Spring 5.3.
|
139 | 133 | *
|
|
0 commit comments