Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

WIP workflow bean injection for Spring Boot #1197

Closed
wants to merge 2 commits into from

Conversation

salaboy
Copy link
Contributor

@salaboy salaboy commented Jan 22, 2025

Description

Creating Spring enabled Workflow and Activity wrappers to support bean injection at Workflows and Activities.

Issue reference

We strive to have all PR being opened based on an issue, where the problem or feature have been discussed prior to implementation.

Please reference the issue this PR will close: #1198

Checklist

Please make sure you've completed the relevant tasks for this PR, out of the following list:

  • Code compiles correctly
  • Created/updated tests
  • Extended the documentation

@salaboy salaboy requested review from a team as code owners January 22, 2025 14:41
Signed-off-by: salaboy <[email protected]>
@artur-ciocanu
Copy link
Contributor

@salaboy I wanted to share an idea with you regarding Spring Bean Injection and the way WorkflowRuntimeBuilder is currently used.

As you already observed, both WorkflowWrapper and WorkflowActivityWrapper are using Class<T> instead of ordinary object instances, which makes the whole Spring Boot integration quite cumbersome.

My proposal is the following:

  1. Rename WorkflowWrapper to WorkflowClassWrapper and WorkflowActivityWrapper to WorkflowActivityClassWrapper
  2. Add two new classes similar WorkflowWrapper and WorkflowActivityWrapper name WorkflowInstanceWrapper and WorkflowActivityInstanceWrapper these will wrap real workflow and activities.
  3. Add two new overloads to WorkflowRuntimeBuilder, similar to these WorkflowRuntimeBuilder registerWorkflow(Class<T> clazz),WorkflowRuntimeBuilder registerActivity(Class<T> clazz) that would get an instance of T instead of Class<T> these methods should be used in the Spring Auto Configuration.

With these changes, things are more straightforward and we don't have to create parallel workflow runtime builder classes just for Spring.

Let me know your thoughts.

@salaboy
Copy link
Contributor Author

salaboy commented Feb 2, 2025

Replaced by @artur-ciocanu in #1201

@salaboy salaboy closed this Feb 2, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Dapr Workflows and activities does not support Bean Injections
3 participants