activiti7.0中使用Context.getCommandContext()为空

activiti7.0引擎中

望采纳

在 Activiti 7.0 中,Context.getCommandContext() 方法已被弃用。相反,您应该使用 CommandContextUtil.getCommandContext() 方法来获取 CommandContext 实例。例如:

CommandContext commandContext = CommandContextUtil.getCommandContext();

请注意,CommandContext 只能在命令执行期间访问,因此您需要确保它在正确的上下文中使用。如果您在非命令执行期间尝试访问 CommandContext,则会抛出异常。