1

spring-boot2 でプロメテウスを使用してメトリクスを生成しており、リアクティブ プログラミングに webflux と r2dbc lib を使用していますが、これらが連携して機能するかどうかはわかりません。私が間違っていることを理解するのを手伝ってください。

次のエラーが発生します

java.lang.NoSuchMethodError: org.springframework.transaction.reactive.TransactionSynchronizationManager.currentTransaction()Lreactor/core/publisher/Mono;
    at org.springframework.data.r2dbc.connectionfactory.ConnectionFactoryUtils.doGetConnection(ConnectionFactoryUtils.java:88) ~[spring-data-r2dbc-1.0.0.M2.jar:1.0.0.M2]   at org.springframework.data.repository.core.support.RepositoryFactorySupport$QueryExecutorMethodInterceptor.invoke(RepositoryFactorySupport.java:605) ~[spring-data-commons-2.2.3.RELEASE.jar:2.2.3.RELEASE]
    at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:186) ~[spring-aop-5.2.2.RELEASE.jar:5.2.2.RELEASE]
    at org.springframework.aop.interceptor.ExposeInvocationInterceptor.invoke(ExposeInvocationInterceptor.java:93) ~[spring-aop-5.2.2.RELEASE.jar:5.2.2.RELEASE]
    at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:186) ~[spring-aop-5.2.2.RELEASE.jar:5.2.2.RELEASE]
    at org.springframework.data.repository.core.support.MethodInvocationValidator.invoke(MethodInvocationValidator.java:99) ~[spring-data-commons-2.2.3.RELEASE.jar:2.2.3.RELEASE]
    at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:186) ~[spring-aop-5.2.2.RELEASE.jar:5.2.2.RELEASE]
    at 

私のbuild.gradleは次のようになります:

 plugins {    
        id("org.springframework.boot") version "2.2.2.RELEASE",
        id ("io.spring.dependency-management") version "1.0.8.RELEASE"
     }
   dependencies {
       implementation ("org.springframework.boot.experimental:spring-boot-starter-r2dbc")
       implementation ("org.springframework.boot.experimental:spring-boot-starter-data-r2dbc")
       implementation ("org.springframework.boot:spring-boot-starter")
       implementation("org.springframework.boot:spring-boot-starter-actuator")
       implementation("io.micrometer:micrometer-registry-prometheus")
       implementation ("org.springframework.boot:spring-boot-starter-webflux")
       testImplementation ("io.projectreactor:reactor-test")
  }

コントローラー関数は次のようになります。

@Timed(histogram = true )
@GetMapping("/abc")
fun process(@PathVariable ab: String): Mono<xyz> {
    return service.getXYZ(xyz)
 }
4

1 に答える 1