Spring mvc ZonedDateTime转换为UTC

Vin*_*nce 5 model-view-controller binding spring utc

我想在应用程序的服务器端将所有java8 ZonedDateTimes转换为UTC时区.我使用@DateTimeFormat成功地将Java 8 jsr310日期数据类型绑定到spring RestController中.

@RequestMapping(value = "rest/test-date", method = RequestMethod.GET)
public TestCollection findPrivilegesByRoleList(
        @RequestParam(value = "local-date", defaultValue = "2015-05-10") @DateTimeFormat(iso = ISO.DATE) LocalDate requestParamDate,
        @RequestParam(value = "local-date-time", defaultValue = "2015-05-16T15:55:56") @DateTimeFormat(iso = ISO.DATE_TIME) LocalDateTime requestParamLocalDateTime,
        @RequestParam(value = "zoned-date-time", defaultValue = "2015-05-18T11:55:56-04:00") @DateTimeFormat(iso = ISO.DATE_TIME) ZonedDateTime requestParamZonedDateTime
        )
Run Code Online (Sandbox Code Playgroud)

对于ZonedDateTime类,我想将所有输入ZonedDateTimes转换为UTC时间,因此服务器端始终在UTC时区中工作.遵循最佳实践#3 - 将其存储在UTC中 http://apiux.com/2013/03/20/5-laws-api-dates-and-times/#comments

对于JSON反序列化,我有一个ZonedDateTime的自定义反序列化器,可将任何时区转换为UTC.

....
//Parse string into a zoned date time with the specified timezone offset - EST, CET, EDT, PST, ect.
ZonedDateTime zonedDateTimewithTimeZone = ZonedDateTime.parse(string, formatter);

//Shift the date time  to UTC Time
return zonedDateTimewithTimeZone.withZoneSameInstant(ZoneId.of("UTC"));
Run Code Online (Sandbox Code Playgroud)

在控制器绑定中进行转换的最佳方法是什么?我知道这可能会迫使多个职责进入同一个班级,但是我想避免添加

ZonedDateTime.withZoneSameInstant

呼叫每个控制器中的每个日期.
谢谢