使用格式化程序在SpringMvc JSON中格式化JodaTime LocalDate
我的Spring应用程序有问题。使用格式化程序在SpringMvc JSON中格式化JodaTime LocalDate,json,spring,format,jodatime,Json,Spring,Format,Jodatime,我的Spring应用程序有问题。 如何在JSON中格式化LocalDate。 问题是,当我发送JSON时,我必须发送一个数字,但当Spring生成JSON时,我有: "data": { "weekyear": 1970, "weekOfWeekyear": 1, "chronology": { "zone": { "fixed": true, "id": "UTC" } },
如何在JSON中格式化
LocalDate
。问题是,当我发送JSON时,我必须发送一个数字,但当Spring生成JSON时,我有:
"data": {
"weekyear": 1970,
"weekOfWeekyear": 1,
"chronology": {
"zone": {
"fixed": true,
"id": "UTC"
}
},
"monthOfYear": 1,
"yearOfEra": 1970,
...and a lot more
我的字段带有注释DateTimeFormat
,如:
@DateTimeFormat(pattern="dd/MM/yyyy")
private LocalDate data;
并在myservlet context.xml中配置了格式服务:
<beans:bean id="conversionService" class="org.springframework.format.support.FormattingConversionServiceFactoryBean">
</beans:bean>
但单凭这一点是不行的,我错过了什么配置