Я генерирую метрики, используя prometheus в spring-boot2, и я использую webflux и r2db c 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)
}