How can I externalise the retry options and activity options in workflow?

My project is in java-springboot. I want to externalise activity options while creating stub for activity in workflow. There are multiple activities and retry options for all will be different.

I tried using @RequiredArgsConstructor and injecting the config file which gets initialised from yml file but this makes the workflow un-deterministic and hence threw an error.

How can i achieve this?

You can specify activity options when registering workflow with the worker.

    worker.registerWorkflowImplementationTypes(
        WorkflowImplementationOptions.newBuilder().setActivityOptions(options).build(),
        MyWorkflow.class);

I want to read options dynamically from config. how can i achieve that?

What do you mean by “dynamically”?