liubao68 commented on issue #1031: 
关于jackson自定Serializer中调用ContextUtils.getInvocationContext()返回null问题
URL: 
https://github.com/apache/servicecomb-java-chassis/issues/1031#issuecomment-446806463
 
 
   这个场景解释起来有些复杂。 ContextUtils.getInvocationContext()被设计为在"业务代码"中使用,比如:
   
   @GetMapping(path="bussiness")
   public String bussiness(String request) {
          ContextUtils.getInvocationContext()
   }
   
   不能在其他地方使用。因为其他地方可能还没有初始化上下文、执行线程无法保障等非常多的复杂场景。 
   另外,ServiceComb的设计也不推荐使用者自定义序列化方式,以保证跨语言、Handler等处理的一致性。
   
   对于你说的这种需要结合“业务条件来进行序列化的场景”, 建议在业务代码中处理,而不是通过定制序列化方式的实现方案。 
   
   

----------------------------------------------------------------
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:
[email protected]


With regards,
Apache Git Services

Reply via email to