I have some @Service FooService
which on request, makes an API call to some external service and returns some FooResult
.
In my project I defined some FooTask
. This is actually a wrapper of a java.util.Function
(and it being used in some CompletableFuture
chain)
Ideally, I'd like the task to call FooService.request()
. One solution could be injecting the FooService
in the constructor but I'm not sure that's a good idea.
What is the Spring way to do that?
Aucun commentaire:
Enregistrer un commentaire