You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@servicecomb.apache.org by GitBox <gi...@apache.org> on 2019/02/18 03:20:30 UTC

[GitHub] liubao68 commented on issue #1095: 请教LocalDateTime的输出形式能否自定义

liubao68 commented on issue #1095: 请教LocalDateTime的输出形式能否自定义
URL: https://github.com/apache/servicecomb-java-chassis/issues/1095#issuecomment-464567496
 
 
   使用ServiceComb的最佳实践里面,不推荐业务定制序列化方式,以保障所有通过代码声明生成的契约的语义都是一致的。 
   提这类问题一般都发生在遗留代码,需要保持老系统接口兼容的场景。 
   你提的问题实际上就提供了一种解决思路: 
   首先定义一个需要输出的json格式,比如 class Time{String createTime}
   或者返回String, 自己序列化。 当然还可以参考RestObjectMapperFactory.setDefaultRestObjectMapper自定义RestObjectMapper,不过这个过程稍微复杂一些,也可能会有其他一些涉及到语义的兼容性问题。

----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on GitHub and use the
URL above to go to the specific comment.
 
For queries about this service, please contact Infrastructure at:
users@infra.apache.org


With regards,
Apache Git Services