spring boot version 3.3.0
When using Spring Coroutine AOP, if the @transactional annotation and a custom AOP are applied together without specifying an order in the Aspect, there is an issue where the custom AOP does not get applied.
@Service
class TargetService() {
private val log = KotlinLogging.logger { }
@Logging
@Transactional
suspend fun aop(): String {
delay(100)
log.info { "aop target method call" }
return "ok"
}
}
@Aspect
//@Order(1)
@Component
class LoggingAspect {
private val log = KotlinLogging.logger {}
@Around("@annotation(com.example.aopwithtransaction.aop.Logging)")
fun logging(joinPoint: ProceedingJoinPoint): Any? {
return mono {
log.info { "Aop Logging started" }
val result = joinPoint.proceed().let { result ->
if (result is Mono<*>) {
result.awaitSingleOrNull()
} else {
result
}
}
log.info { "Aop Logging completed" }
result
}
}
}
In cases like the one above, the custom AOP does not function unless the order is specified, in which case it does function.
This is a simple example : https://github.com/backtony/spring-reactive-aop-transaction
When using Spring Coroutine AOP, if the @transactional annotation and a custom AOP are applied together without specifying an order in the Aspect, there is an issue where the custom AOP does not get applied.
In cases like the one above, the custom AOP does not function unless the order is specified, in which case it does function.
This is a simple example : https://github.com/backtony/spring-reactive-aop-transaction