Skip to content
Advertisement

ReactiveCrudRepository vs. R2dbcRepository

I am learning the reactive stack starting with R2DBC and this is what I don’t understand:

What are the differences between these, when to use them, and how relevant the @Repository stereotype annotation is to them?

  • org.springframework.data.r2dbc.repository.R2dbcRepository
  • org.springframework.data.repository.reactive.ReactiveCrudRepository;

As far as I understand, both of them are @NoRepositoryBean and both are shipped together through the org.springframework.boot:spring-boot-starter-data-r2dbc dependency.

Advertisement

Answer

There is no difference between both, R2dbcRepository extends ReactiveCrudRepository and not add any functionality (R2dbcRepository java doc), probably it’s just a name convention, just like @Service has the same comportament as @Component. About the @Repository annotation, you haven’t to annotate any class that extends from repository interfaces to them work.

User contributions licensed under: CC BY-SA
9 People found this is helpful
Advertisement