-
Notifications
You must be signed in to change notification settings - Fork 207
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
Spring Boot, Workflows and dependency injection #1147
Comments
cc @salaboy, if you don't mind, since we talked about this |
Let's work into supporting this with the new starters.. there is no code in the SDK to support that injection yet. |
@salaboy just to be clear are you saying that both Workflows and Activities should support dependency injection in the Java SDK? As it stands, the dotnet experience for Workflows does not allow dependency injection for Workflows, but it does for Activities. This is due to the desire to keep non-deterministic behaviours out of the workflow code, as injected dependencies are considered a risk for containing non-deterministic behaviour. I know that the language SDKs have to follow the idioms of their languages, and rightly so, but this feels like something we should strive for parity on across all the SDKs. Thoughts? cc @WhitWaldo |
@olitomlinson yeah.. in my opinion, that is what a Spring Boot user would expect. Without that the experience is very clunky. |
I agree that the SDKs should absolutely take a uniform approach. As @olitomlinson said, right now, .NET allows injection into activities, but not workflows because the former are intended to be non-deterministic, but the latter strictly must be. This came up in Discord about whether workflows should allow injection for logging purposes and while I can see the case for it being made available on the workflow context itself (which is resolved from DI), I still don't think workflows themselves should allow injection. |
Good point.. I will look into that.
…On Tue, Oct 29, 2024 at 10:19 AM Whit Waldo ***@***.***> wrote:
I agree that the SDKs should absolutely take a uniform approach. As
@olitomlinson <https://github.com/olitomlinson> said, right now, .NET
allows injection into activities, but not workflows because the former are
intended to be non-deterministic, but the latter strictly must be.
This came up in Discord about whether workflows should allow injection for
logging purposes and while I can see the case for it being made available
on the workflow context itself (which is resolved from DI), I still don't
think workflows themselves should allow injection.
—
Reply to this email directly, view it on GitHub
<#1147 (comment)>,
or unsubscribe
<https://github.com/notifications/unsubscribe-auth/AACCMXVD4E6GBJNRA3MKFZTZ55OJHAVCNFSM6AAAAABQDE6PR2VHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMZDINBTHAYDQNRWGI>
.
You are receiving this because you were mentioned.Message ID:
***@***.***>
--
- Blog: http://salaboy.com <http://salaboy.wordpress.com>
- Github user: http://github.com/salaboy
- Twitter: http://twitter.com/salaboy
- Mauricio "Salaboy" Salatino -
|
Ask your question here
Without further knowledge about the Dapr Java SDK, is dependency injection for workflow activities (and probably workflows itself) not supported at the moment?
Check this example here: https://github.com/jakesmolka/dapr-workflow/blob/6629ad6935165a49147754187fc7b3ba4d073817/workflow-lib/src/main/java/org/example/flows/CreateResourceActivity.java
I get the following error, when running the workflow worker:
When removing the entire dependency injection it works (compiles, run, behaves as expected).
When using deprecated
@Autowired
field injection the worker compiles and runs but just gets a null object.The text was updated successfully, but these errors were encountered: