When trying to compile a native Spring Data JDBC + Boot 3.2.0-M3 app with CRaC dependency on the classpath, I get this error

org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.obtainFromSupplier(AbstractAutowireCapableBeanFactory.java:1218) ~[org.springframework.samples.petclinic.PetClinicApplication:6.1.0-SNAPSHOT]
        ... 17 common frames omitted
Caused by: java.lang.IllegalArgumentException: Unable to locate closeConnectionExecutor for HikariPool
        at org.springframework.util.Assert.notNull(Assert.java:172) ~[na:na]
        at org.springframework.boot.jdbc.HikariCheckpointRestoreLifecycle.<clinit>(HikariCheckpointRestoreLifecycle.java:60) ~[org.springframework.samples.petclinic.PetClinicApplication:3.2.0-M3]
        ... 28 common frames omitted

Being able to use both CRaC or native for deployment looks a valid use case to me, so we should probably add relevant hints for this not so common but possible use case.

Comment From: wilkinsona

I don't think we should add hints for this. It sets us down a path where we will potentially bloat the native image with code that's CRaC-specific and will never be executed.

If we want to do something, I think it would be better for @ConditionalOnCheckpointRestore to back off somehow. I'm not sure how we'd do that as you may want to use AOT on the JVM and CRaC. We'd somehow need to know that AOT is being run as a step towards build a native image.

In the meantime, I would recommend tackling this in the project's build such that the CRaC dependency isn't on the classpath when you're targeting Graal.

Comment From: sdeleuze

In the meantime, I would recommend tackling this in the project's build such that the CRaC dependency isn't on the classpath when you're targeting Graal.

Maybe worth a related note on https://github.com/spring-projects/spring-boot/wiki/Spring-Boot-with-GraalVM.

Comment From: wilkinsona

I've added something to the general section.