HTTP Status 406 - @RequestMapping(value = "/queryList", produces = {"application/json;charset=UTF-8"}, method = RequestMethod.GET) @ResponseBody public List queryList(AdContent adContent,PageParam pageParam) { pageParam.setPageNum(1); pageParam.setPageSize(2); PageInfo<AdContent> queryListWithPage = adContentService.queryListWithPage(adContent, pageParam); return queryListWithPage.getList(); } 把list数据内类型转换成json缺乏依赖包 <dependency> <groupId>com.fasterxml.jackson.core</groupId> <artifactId>jackson-databind</artifactId> <version>2.4.2</version> </dependency>
异常:java.sql.SQLException: Value '0000-00-00' can not be represented as java.sql.Timestamp 数据库字段: `createDate` datetime NOT NULL DEFAULT '0000-00-00 00:00:00' COMMENT '建立时间', `updateDate` datetime NOT NULL DEFAULT '0000-00-00 00:00:00' COMMENT '更新时间', 错误分析: Datetimes with all-zero components (0000-00-00 ...) — These values can not be represented 关于全部Datetime类型由0组成的数据,这些值不能在java中被可靠的表示 解决方式: 设置为convertToNull,用NULL值来代替这个日期类型 jdbc:MySQL://localhost/jiutong_ad?useUnicode=true&characterEncoding=utf8&zeroDateTimeBehavior=convertToNull