eventuate-foundation / eventuate-common

Other
10 stars 20 forks source link

using a more update to date version of springBootVersion #93

Open kwonglau opened 3 years ago

kwonglau commented 3 years ago

spring data r2dbc api evolve pretty quick

when update springBootVersion in gradle.properties (https://github.com/eventuate-foundation/eventuate-common/blob/master/gradle.properties#L14) to a more recent version and updating the dependency of org.springframework.data:spring-data-r2dbc to org.springframework.boot:spring-boot-starter-data-r2dbc. The EventuateCommonReactiveJdbcOperationsTest failed because of missing Bean Exception. Most recent Spring Boot version will not create TransactionTemplate and PlatformTransactionManager when TransactionalOperator bean exists.

Spring Boot 1.4.7 version https://github.com/spring-projects/spring-boot/blob/1.4.x/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/transaction/TransactionAutoConfiguration.java

latest version (e.g. 2.5.0-RC1) https://github.com/spring-projects/spring-boot/blob/main/spring-boot-project/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/transaction/TransactionAutoConfiguration.java#L77

I'm also thinking we may need to create a reactive version of EventuateSpringTransactionTemplate like the following


  private final TransactionalOperator transactionalOperator;

  public EventuateSpringTransactionTemplate(TransactionalOperator transactionalOperator) {
    this.transactionalOperator = transactionalOperator;
  }

  @Override
  public <T> Mono<T> executeInTransaction(Supplier<Mono<T>> callback) {
    return callback.get()
        .as(transactionalOperator::transactional);
  }

}

even not replacing org.springframework.data:spring-data-r2dbc with org.springframework.boot:spring-boot-starter-data-r2dbc. The test is still failing with the same error.