解决方法
1. 局部配置
@DateTimeFormat(pattern="yyyy-MM-dd")
@JSONField(format="yyyy-MM-dd")
private Date birthday; //出生日期
2.全局配置(仅适用于fastJson)
修改FastJsonHttpDateFormat中features属性
此时UserController下的方法应直接返回一个对象,而不是一个json格式字符串
<beans>
<mvc:annotation-driven>
<mvc:message-converters>
<bean class="com.alibaba.fastjson.support.spring.FastJsonHttpMessageConverter">
<property name="supportedMediaTypes">
<list>
<value>text/html;charset=UTF-8</value>
<value>application/json</value>
</list>
</property>
<property name="features">
<list>
<value>WriteDateUseDateFormat</value>
</list>
</property>
</bean>
</mvc:message-converters>
</mvc:annotation-driven>
</beans>
OR
<beans>
<mvc:annotation-driven>
<mvc:message-converters>
<bean class="com.alibaba.fastjson.support.spring.FastJsonHttpMessageConverter">
<property name="supportedMediaTypes">
<list>
<value>text/html;charset=UTF-8</value>
<value>application/json</value>
</list>
</property>
<property name="dateFormat">
<value>yyyy-MM-dd</value>
</property>
</bean>
</mvc:message-converters>
</mvc:annotation-driven>
</beans>