Skip to content

CGLIB runtime enhancement not supported on native image with Spring Boot 4 #49350

@Vadym79

Description

@Vadym79

I have an example application which uses Spring Boot 4, Spring JPA with Hibernate, PostgreSQL database. The goal is to produce a GraalVM Native Image deploy it on AWS Lambda as Custom Runtime. The issue should be reproducable by simply running the native image without AWS Lambda.

During start up of AWS Lambda, I got the following exception:

Caused by: java.lang.UnsupportedOperationException: CGLIB runtime enhancement not supported on native image. Make sure to enable Spring AOT processing to pre-generate 'org.springframework.orm.jpa.LocalContainerEntityManagerFactoryBean$$SpringCGLIB$$0' at build time.

It's coming from definition of the PlatformTransactionManager in the PersistenceJPAConfig.java used to create LocalContainerEntityManagerFactoryBean.

I expect that this class org.springframework.orm.jpa.LocalContainerEntityManagerFactoryBean$$SpringCGLIB$$0 should be generated at the compile time as I use Spring AOT processor in pom.xml.

What I'm doing wrong?

The only way I found to currently mitigate the issue, is to use @Configuration(proxyBeanMethods = false) in the PersistenceJPAConfig, but I have an impression that I'm loosing performance by not proxying the bean methods.

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions