Skip to content

SimpleR2dbcRepository does not support custom subclasses #416

@ada-waffles

Description

@ada-waffles

This section of the Spring Data Reference Documentation describes how a custom repository base class can be used.

It notes that, when doing so, one must override/provide a constructor with the signature (EntityInformation<T, ID>, StoreOperations, ...).

In the case of SimpleR2dbcRepository, that would be SimpleR2dbcRepository(RelationalEntityInformation<T, ID>, R2dbcEntityOperations, R2dbcConverter). However, that constructor is package-private.

Attempting to override the public constructor yields an error on bean instantiation saying to provide the other signature. It is also not possible to convert from the desired signature to the public one, as there does not appear to be a publicly-accessible way to pull the ReactiveDataAccessStrategy back out of the R2dbcEntityOperations (The trick the R2dbcEntityTemplate constructor uses to pull it out of the DatabaseClient won't work as DefaultDatabaseClient is also package-private).

Is there a particular reason that constructor is package-private? The fact that it is seems to me to be the only thing preventing the use of a custom base class. Or is there something else I'm missing?

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions