-
Notifications
You must be signed in to change notification settings - Fork 38.8k
Closed
Labels
in: webIssues in web modules (web, webmvc, webflux, websocket)Issues in web modules (web, webmvc, webflux, websocket)type: enhancementA general enhancementA general enhancement
Milestone
Description
Marcel Overdijk opened SPR-11431 and commented
The current org.springframework.http.converter.json.Jackson2ObjectMapperFactoryBean has no direct support for setting the PropertyNamingStrategy.
This would be very useful to e.g. change output to snake_case instead of CamelCase.
Currently I use a MethodInvokingFactoryBean to do this like:
<bean id="objectMapper" class="org.springframework.http.converter.json.Jackson2ObjectMapperFactoryBean">
<property name="dateFormat"><bean class="com.fasterxml.jackson.databind.util.ISO8601DateFormat" /></property>
<property name="indentOutput" value="true" />
</bean>
<bean class="org.springframework.beans.factory.config.MethodInvokingFactoryBean">
<property name="targetObject" ref="objectMapper" />
<property name="targetMethod" value="setPropertyNamingStrategy" />
<property name="arguments">
<list>
<bean class="com.fasterxml.jackson.databind.PropertyNamingStrategy.LowerCaseWithUnderscoresStrategy" />
</list>
</property>
</bean>
Please add setPropertyNamingStrategy method to Jackson2ObjectMapperFactoryBean.
Affects: 4.0.1
Metadata
Metadata
Assignees
Labels
in: webIssues in web modules (web, webmvc, webflux, websocket)Issues in web modules (web, webmvc, webflux, websocket)type: enhancementA general enhancementA general enhancement