Context.getCommandContext() returns null

I want to resolve assignee expression in TaskDefinition Object like:
Object _assignee = i.getAssigneeExpression().isLiteralText() ? i.getAssigneeExpression().getExpressionText() : i.getAssigneeExpression().getValue(_excution);
when I step into the code, I find that static method like Context.getProcessEngineConfiguration(), Context.getCommandContext() returns null.
I wonder why. My app is a springboot app, does it matter?

Hi @penghaodian ,

could you please provide more code around this block? Where do you want to call that code (e. g. inside an execution listener) and what exactly do you want to achieve?

In general a command context is only available while you are inside the execution of a command that was submitted to a command executor (by default the CommandContextInterceptor is responsible for this behaviour). Then the corresponding context can be accessed using afore-mentioned methods.

Kind regards,