I am generating metrics using prometheus in spring-boot2 and I am using webflux and r2dbc lib for reactive programming, however I am not sure if these works together. Please help me to understand what i am doing wrong.
It gives following error
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
My build.gradle looks like this:
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")
}
Controller function look like this:
@Timed(histogram = true )
@GetMapping("/abc")
fun process(@PathVariable ab: String): Mono<xyz> {
return service.getXYZ(xyz)
}