I'm making an asynchronous repository using spring. I'm extending JpaRepository, which in turn extends CrudRepository. On my own methods I'm using the Async annotation so that they return CompletableFuture. Can I make the save function in CrudRepository return a CompletableFuture?
Asked
Active
Viewed 733 times
0

chrylis -cautiouslyoptimistic-
- 75,269
- 21
- 115
- 152

SiXoS
- 535
- 3
- 14
-
Did you try it? – chrylis -cautiouslyoptimistic- Oct 12 '16 at 06:53
-
Try what? I tried assuming that it would return a CompletableFuture to see if Spring sprinkled its' magic but that didn't work. – SiXoS Oct 12 '16 at 06:55
-
http://docs.spring.io/spring-data/elasticsearch/docs/current/reference/html/#repositories.query-async – Tim Weber Oct 12 '16 at 07:04
-
Yes, but i can't put an annotation on a method which lies in the internals of Spring. It's not my own method. It is a member of CrudRepository. If I try to Override the function with an async tag and specifiyng that it should return a CompletableFuture it says that the return type doesn't match the parent specification. – SiXoS Oct 12 '16 at 07:11
-
Did you manage to solve this? – David Krenkel Apr 07 '17 at 13:48
-
@DavidKrenkel Unfortunately not. I made a wrapper class instead... – SiXoS Apr 08 '17 at 21:31