Spring Data has provision for various non-JDK types to be returned by repository methods, for example, a Vavr Seq
from a multiple-result query and a Vavr Option
from a single-result query. Does Spring Data have provision for me to register other collection and option/maybe types?
Yes, the already exsiting support for Vavr and Eclipse Collections is open for extension. All you need to do is provide an implementation of org.springframework.data.util.CustomCollectionRegistrar
and register it in META/INF/spring.factories
:
org.springframework.data.util.CustomCollectionRegistrar=com.acme.YourImplementation
Existing implementations can be found in:
org.springframework.data.util.CustomCollections.VavrCollections
org.springframework.data.util.CustomCollections.EclipseCollections