-
Notifications
You must be signed in to change notification settings - Fork 38.3k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Support invoking bridged suspending functions in AopUtils
#33045
Comments
Could you please check with the latest Boot 3.2 patch release available and provide a self contained reproducer (link to a repository or an attached archive)? |
Same issue on Spring Boot Version 3.3 @SpringBootApplication
open class BuggyKotlinApplication
open class SomeClass()
open interface A<T> {
suspend fun nonTransactional(a: T)
suspend fun transactional(a: T)
}
@Component
open class B : A<SomeClass> {
val logger = org.slf4j.LoggerFactory.getLogger(this::class.java)
override suspend fun nonTransactional(a: SomeClass) {
logger.info("f1 called")
}
@Transactional
override suspend fun transactional(a: SomeClass) {
logger.info("f2 called")
}
}
@Service
class SomeService(
private val component : A<SomeClass>
) {
suspend fun test() {
component.nonTransactional(SomeClass())
}
@Transactional
suspend fun test2() {
component.transactional(SomeClass())
}
}
@RestController
class SomeController(
private val service: SomeService
) {
@GetMapping("/")
suspend fun test(): String {
service.test()
return "test"
}
@GetMapping("/tx")
suspend fun tx(): String {
service.test2()
return "tx"
}
@GetMapping("/both")
suspend fun both(): String {
service.test()
service.test2()
return "both"
}
@GetMapping("/both-rev")
suspend fun bothRev(): String {
service.test2()
service.test()
return "both-rev"
}
}
fun main(args: Array<String>) {
runApplication<BuggyKotlinApplication>(*args)
} |
The issue seems to exists in all 3.2.x and 3.3.x branches. The latest version I could not reproduce this was 3.1.12. Notable change from 3.1.x to 3.2.0 was introduction of AOP support for Kotlin coroutines: #22462 My guess is that the previous support was somewhat limited / broken (it worked properly until the coroutine suspended first - which would break I understand the AOP support is somewhat limited as indicated by the issue, however for aspects like |
Please provide a self-contained reproducer (link to a repository or an attached archive) as asked above. |
If you would like us to look at this issue, please provide the requested information. If the information is not provided within the next 7 days this issue will be closed. |
AopUtils
Thrown java.lang.NullPointerException when call method with generic type parameters from proxied class.
Case:
Stack trace:
Example solve:
add bridge method resolve in
spring-framework/spring-aop/src/main/java/org/springframework/aop/framework/CglibAopProxy.java
Line 720 in 5edb4cb
Affects: <Spring Framework 6.1, Spring Boot 3.2.0>
The text was updated successfully, but these errors were encountered: