springMVC 【@response 返回对象自动变成json并且防止乱码】 & 【配置支持实体类中的@DateTimeFormat注解】
2015-08-11 17:12
579 查看
在springmvc的配置文件中加上这一段即可
<bean class="org.springframework.web.servlet.mvc.annotation.AnnotationMethodHandlerAdapter" > <!-- 本文关键内容--> <property name="messageConverters"> <list> <bean class="org.springframework.http.converter.json.MappingJackson2HttpMessageConverter" > <property name="supportedMediaTypes"> <value>text/html;charset=UTF-8</value> </property> </bean> </list> </property> <!-- 支持@DateTimeFormat(pattern="yyyy-MM-dd")等注解 2015年7月31日11:07:03 liuyx--> <property name="webBindingInitializer"> <bean class="org.springframework.web.bind.support.ConfigurableWebBindingInitializer"> <property name="conversionService"> <bean class="org.springframework.format.support.FormattingConversionServiceFactoryBean"></bean> </property> </bean> </property> </bean>
相关文章推荐
- jdk自带的jvm监控工具
- 字符串分割--java中String.split()用法
- 字符串排序问题
- eclipse的WEB项目无理由错误
- JAVA,Play framework 入门,打印hello word
- eclipse Android关联源码
- mybatis 与spring整合配置
- java.net.InetAddress类的使用
- Java泛型详解
- php-wamp+eclipse+php环境搭建
- eclipse配置
- Java学习笔记
- JAVA 注册 HUANXIN 即时通信
- 【WEB-INF】WEB-INF是Java的WEB应用的安全目录
- 自动生成Myeclipse7.5注册码
- ubuntu下使用eclipse时logcat只显示Level,其他信息均无显示
- Java中的instanceof关键字
- byte&oxff到底为什么【java中的负数】
- MyEclipse 2015优化技巧
- spring注解( @Autowired、@Qualifier、@Resource、@PostConstruct、@PreDestroy、 @Component、@Scope)-描述的比较清楚