Childworkflow test failing

I am trying to test my childworkflow. Register the workflowImpl class, register the activities impl. I start my test env and then the following error comes up exactly at the point of calling workflow method.
Error logs:

java.lang.Error: Failure instantiating workflow implementation class
	at io.temporal.internal.sync.POJOWorkflowImplementationFactory$POJOWorkflowImplementation$RootWorkflowInboundCallsInterceptor.newInstance(
	at io.temporal.internal.sync.POJOWorkflowImplementationFactory$POJOWorkflowImplementation$RootWorkflowInboundCallsInterceptor.init(
	at io.temporal.internal.sync.POJOWorkflowImplementationFactory$POJOWorkflowImplementation.initialize(
	at io.temporal.internal.sync.SyncWorkflow.lambda$start$1(
	at io.temporal.internal.sync.WorkflowThreadImpl$
	at io.temporal.worker.ActiveThreadReportingExecutor.lambda$submit$0(
	at java.base/java.util.concurrent.Executors$
	at java.base/
	at java.base/java.util.concurrent.ThreadPoolExecutor.runWorker(
	at java.base/java.util.concurrent.ThreadPoolExecutor$
	at java.base/
Caused by: java.lang.NoSuchMethodException:<init>()
	at java.base/java.lang.Class.getConstructor0(
	at java.base/java.lang.Class.getDeclaredConstructor(
	at io.temporal.internal.sync.POJOWorkflowImplementationFactory$POJOWorkflowImplementation$RootWorkflowInboundCallsInterceptor.newInstance(
	... 11 common frames omitted

Also, the first line of my child workflow uses Workflow.await(Duration, unblock_condition) if that helps

Does the child workflow class have a public no arguments constructor?

No. It doesn’t. I annotated it with just @RequiredArgsConstructor owning to the fact that all it’s fields are final. How does it matter though ? I had the parent workflow with the same @RequiredArgsConstructor and the tests worked just fine there.

I don’t know much about these annotations. But Temporal uses reflection to instantiate a workflow object using non argument constructor. So any class that doesn’t provide such a constructor cannot be used as a workflow implementation.

Hi Maxim, thanks for the answer, I moved ahead by introducing a no-args constructor to my workflow impl. However, My workflow has some fields that were autowired with beans.
In my test env, I want those beans to be mocked and injected to my workflow implementation. how can I achieve that ? currently I am getting those fields as null. I am using spring-boot

We don’t recommend using dependency injection with workflows. Workflow code must be deterministic and injection can break it easily in subtle ways.

What is the use case for injecting fields into the workflow object?

Was not well versed with this being a non-deterministic thing. Have now wrapped up my logic, that required bean autowiring, inside activities. It works fine now. Probably I was writing code for workflows the wrong way.