-
Notifications
You must be signed in to change notification settings - Fork 38.7k
Closed
Labels
in: coreIssues in core modules (aop, beans, core, context, expression)Issues in core modules (aop, beans, core, context, expression)theme: kotlinAn issue related to Kotlin supportAn issue related to Kotlin supporttype: bugA general bugA general bug
Milestone
Description
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
Metadata
Metadata
Assignees
Labels
in: coreIssues in core modules (aop, beans, core, context, expression)Issues in core modules (aop, beans, core, context, expression)theme: kotlinAn issue related to Kotlin supportAn issue related to Kotlin supporttype: bugA general bugA general bug