3

I can make required tweaks via:

@EnableR2dbcRepositories(repositoryBaseClass = BaseRepo::class)

but this is too high level. Essentially I override top level method with custom behaviour which needs to be done at R2dbcEntityTemplate.class level so would be great if I could provide custom R2DBC teamplate. I tried declaring bean but it doesn't pick mine, predictably due to being hardcoded in:

/*
 * (non-Javadoc)
 * @see org.springframework.data.repository.core.support.RepositoryFactorySupport#getTargetRepository(org.springframework.data.repository.core.RepositoryInformation)
 */
@Override
protected Object getTargetRepository(RepositoryInformation information) {

    RelationalEntityInformation<?, ?> entityInformation = getEntityInformation(information.getDomainType(),
            information);

    return getTargetRepositoryViaReflection(information, entityInformation,
            new R2dbcEntityTemplate(this.databaseClient, this.dataAccessStrategy), this.converter);
}
Aubergine
  • 5,862
  • 19
  • 66
  • 110

1 Answers1

1

Instead of repositoryBaseClass, you can use

@EnableR2dbcRepositories(repositoryFactoryBeanClass = MyR2dbcRepositoryFactoryBean.class)

Then on your MyR2dbcRepositoryFactoryBean you can set your own R2dbcEntityTemplate use the method setEntityOperations

Zinc
  • 1,064
  • 3
  • 16