• @DateTimeFormat(pattern = “yyyy-MM-dd”)
    • @JsonFormat(timezone = “GMT+8”, pattern = “yyyy/MM/dd”)

    @DateTimeFormat其实是作为Formatter被注册到ConvertionService中了
    @JsonFormat被MappingJackson2HttpMessageConverter处理

    @DateTimeFormat 处理:

    1. POST /testdate3 HTTP/1.1
    2. Host: localhost:8082
    3. Content-Type: application/x-www-form-urlencoded
    4. Cache-Control: no-cache
    5. Postman-Token: c764abc6-768e-dab0-f46a-19037c33921a
    6. name=asdf&date=2018-11-2+2%3A22%3A2

    @JsonFormat处理:

    1. POST /testdate HTTP/1.1
    2. Host: localhost:8082
    3. Content-Type: application/json
    4. Cache-Control: no-cache
    5. Postman-Token: e9017210-0f4d-c86c-51c8-18f7ccafc93d
    6. {"name":"aaaa","id":1,"date":"2018/11/2 2:22:2"}