1.@JsonFormat解決時間格式不規範
數據庫返回的數據:
在Bean類中設置:@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss",timezone = "GMT+8")
修改後返回的數據:
2.BeanUtils.copyProperties無法複製date類型
user對象和formBean對象都有屬性birthday,而且都是java.sql.Date類型的
當進行BeanUtils.copyProperties(user,formBean);複製屬性時候,formBean中屬性birthday爲null
2.1手動添加數據:
2.2導入import org.dozer.Mapper
在pom配置
<dependency>
<groupId>net.sf.dozer</groupId>
<artifactId>dozer</artifactId>
<version>5.5.1</version>
</dependency>
<dependency>
<groupId>net.sf.dozer</groupId>
<artifactId>dozer-spring</artifactId>
<version>5.5.1</version>
</dependency>
3.Mapper中報Could not autowire. No beans of 'UserMapper' type found.
在配置中把這個Autowiring for Bean Class選項取消