Skip to content

spring-tx causes cglib error in java native runtime for repository beans defined by interface #34329

@jzhn

Description

@jzhn

What

Spring boot uses AOT processing to generate required reflect/proxy/resource configs as well as CGLIB proxy classes in compile time. For beans defined with interface types, CGLIB proxy is usually unnecessary so process-aot job does not generate CGLIB proxy.

When org.springframework.data:spring-data-mongodb is imported, java native projects with repository beans defined with interface types will encounter exception in runtime about unexpected CGLIB usage for the repository class.

Update: upon further investigation, just having org.springframework:spring-tx is enough to trigger the issue. It's not directly caused by spring-data-mongodb.

Minimum reproduciable project

https://github.com/jzhn/springNativeBugSpringDataMongoDB. Please refer to its README for steps to reproduce, expected behaviour and actual behaviour.

Versions

  • JDK: 21.0.2-graalce
  • Spring-Boot: 3.4.2 (latest to date)
  • MacOS 15.2 on ARM64 mac

Metadata

Metadata

Assignees

No one assigned

    Labels

    status: invalidAn issue that we don't feel is valid

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions