Skip to content

Commit e40a239

Browse files
Fix test
1 parent 4c1b9a6 commit e40a239

2 files changed

Lines changed: 7 additions & 2 deletions

File tree

temporal-sdk/src/main/java/io/temporal/internal/sync/POJOWorkflowImplementationFactory.java

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -50,7 +50,6 @@
5050
import io.temporal.worker.WorkflowImplementationOptions;
5151
import io.temporal.workflow.DynamicWorkflow;
5252
import io.temporal.workflow.Functions;
53-
import io.temporal.workflow.Functions.Func;
5453
import java.lang.reflect.Constructor;
5554
import java.lang.reflect.InvocationTargetException;
5655
import java.lang.reflect.Method;
@@ -156,7 +155,7 @@ public <R> void addWorkflowImplementationFactory(
156155
"An implementation of DynamicWorkflow or its factory is already registered with the worker");
157156
}
158157
dynamicWorkflowImplementationFactory =
159-
(unused) -> ((Func<? extends DynamicWorkflow>) factory).apply();
158+
(Functions.Func1<EncodedValues, ? extends DynamicWorkflow>) factory;
160159
return;
161160
}
162161
workflowInstanceFactories.put(clazz, factory);

temporal-spring-boot-autoconfigure/src/main/java/io/temporal/spring/boot/autoconfigure/template/WorkersTemplate.java

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -525,8 +525,14 @@ private <T> void configureWorkflowImplementation(Worker worker, Class<?> clazz)
525525
WorkflowImplementationOptions workflowImplementationOptions =
526526
new WorkflowImplementationOptionsTemplate(workflowImplementationCustomizer)
527527
.createWorkflowImplementationOptions();
528+
528529
WorkerDeploymentOptions deploymentOptions = worker.getWorkerOptions().getDeploymentOptions();
530+
531+
// If the workflow implementation class has a constructor annotated with @WorkflowInit,
532+
// we need to register it as a workflow factory.
529533
if (workflowMetadata.getWorkflowInit() != null) {
534+
// Currently, we only support one workflow method in a class with a constructor annotated with
535+
// @WorkflowInit.
530536
if (workflowMethods.size() > 1) {
531537
throw new BeanDefinitionValidationException(
532538
"Workflow implementation class "

0 commit comments

Comments
 (0)