2015-09-15 23 views
0

我在swagger-codegen中生成的Java Spring-MVC中使用了swagger-ui和存根服務器。我有一個日期格式的地方,如果我輸入日期,它總是返回我的UNIX日期時間格式。我想爲日期和日期時間使用RFC-3339格式。有誰知道如何做到這一點?序列化日期:Swagger和Spring-MVC

回答

0

我找到了答案..

我不得不覆蓋JsonFormat因爲我回一個JSON對象..

因此,如果你有同樣的問題,因爲我使用:

@JsonFormat(pattern="...") 
Date foo; 

不要忘記使用import com.fasterxml.jackson.annotation.JsonFormat;