As discovered by @joshlong during a demo:

18:25:01: Executing ':classes :testClasses :aotClasses :aotTestClasses'...

> Task :compileJava
> Task :processResources UP-TO-DATE
> Task :classes
> Task :compileTestJava
> Task :processTestResources NO-SOURCE
> Task :testClasses
> Task :resolveMainClassName

> Task :processAot FAILED

  .   ____          _            __ _ _
 /\\ / ___'_ __ _ _(_)_ __  __ _ \ \ \ \
( ( )\___ | '_ | '_| | '_ \/ _` | \ \ \ \
 \\/  ___)| |_)| | | | | || (_| |  ) ) ) )
  '  |____| .__|_| |_|_| |_\__, | / / / /
 =========|_|==============|___/=/_/_/_/
 :: Spring Boot ::       (v3.1.0-SNAPSHOT)

2023-05-15T18:25:02.998+02:00  INFO 31731 --- [           main] com.example.service.ServiceApplication   : Starting ServiceApplication using Java 17.0.5 with PID 31731 (/Users/jlong/Downloads/service/build/classes/java/main started by jlong in /Users/jlong/Downloads/service)
2023-05-15T18:25:03.000+02:00  INFO 31731 --- [           main] com.example.service.ServiceApplication   : No active profile set, falling back to 1 default profile: "default"
2023-05-15T18:25:03.036+02:00  INFO 31731 --- [           main] .s.b.d.c.l.DockerComposeLifecycleManager : Using Docker Compose file '/Users/jlong/Downloads/service/docker-compose.yml'
2023-05-15T18:25:04.018+02:00  INFO 31731 --- [           main] .s.d.r.c.RepositoryConfigurationDelegate : Bootstrapping Spring Data JDBC repositories in DEFAULT mode.
2023-05-15T18:25:04.040+02:00  INFO 31731 --- [           main] .s.d.r.c.RepositoryConfigurationDelegate : Finished Spring Data repository scanning in 19 ms. Found 1 JDBC repository interfaces.
5 actionable tasks: 4 executed, 1 up-to-date
Exception in thread "main" java.lang.IllegalArgumentException: Code generation is not supported for bean definitions declaring an instance supplier callback : Root bean: class [org.springframework.boot.docker.compose.service.connection.postgres.PostgresJdbcDockerComposeConnectionDetailsFactory$PostgresJdbcDockerComposeConnectionDetails]; scope=singleton; abstract=false; lazyInit=null; autowireMode=0; dependencyCheck=0; autowireCandidate=true; primary=false; factoryBeanName=null; factoryMethodName=null; initMethodNames=null; destroyMethodNames=null
    at org.springframework.beans.factory.aot.BeanDefinitionMethodGenerator.<init>(BeanDefinitionMethodGenerator.java:82)
    at org.springframework.beans.factory.aot.BeanDefinitionMethodGeneratorFactory.getBeanDefinitionMethodGenerator(BeanDefinitionMethodGeneratorFactory.java:100)
    at org.springframework.beans.factory.aot.BeanDefinitionMethodGeneratorFactory.getBeanDefinitionMethodGenerator(BeanDefinitionMethodGeneratorFactory.java:115)
    at org.springframework.beans.factory.aot.BeanRegistrationsAotProcessor.processAheadOfTime(BeanRegistrationsAotProcessor.java:49)
    at org.springframework.beans.factory.aot.BeanRegistrationsAotProcessor.processAheadOfTime(BeanRegistrationsAotProcessor.java:37)
    at org.springframework.context.aot.BeanFactoryInitializationAotContributions.getContributions(BeanFactoryInitializationAotContributions.java:67)
    at org.springframework.context.aot.BeanFactoryInitializationAotContributions.<init>(BeanFactoryInitializationAotContributions.java:49)
    at org.springframework.context.aot.BeanFactoryInitializationAotContributions.<init>(BeanFactoryInitializationAotContributions.java:44)
    at org.springframework.context.aot.ApplicationContextAotGenerator.lambda$processAheadOfTime$0(ApplicationContextAotGenerator.java:58)
    at org.springframework.context.aot.ApplicationContextAotGenerator.withCglibClassHandler(ApplicationContextAotGenerator.java:67)
    at org.springframework.context.aot.ApplicationContextAotGenerator.processAheadOfTime(ApplicationContextAotGenerator.java:53)
    at org.springframework.context.aot.ContextAotProcessor.performAotProcessing(ContextAotProcessor.java:106)
    at org.springframework.context.aot.ContextAotProcessor.doProcess(ContextAotProcessor.java:84)
    at org.springframework.context.aot.ContextAotProcessor.doProcess(ContextAotProcessor.java:49)
    at org.springframework.context.aot.AbstractAotProcessor.process(AbstractAotProcessor.java:82)
    at org.springframework.boot.SpringApplicationAotProcessor.main(SpringApplicationAotProcessor.java:80)

FAILURE: Build failed with an exception.

* What went wrong:
Execution failed for task ':processAot'.
> Process 'command '/Users/jlong/.sdkman/candidates/java/22.3.r17-grl/bin/java'' finished with non-zero exit value 1

* Try:
> Run with --stacktrace option to get the stack trace.
> Run with --info or --debug option to get more log output.
> Run with --scan to get full insights.

* Get more help at https://help.gradle.org/

BUILD FAILED in 2s
18:25:04: Execution finished ':classes :testClasses :aotClasses :aotTestClasses'.

Comment From: joshlong

Basically the Docker compose stuff is included and causes pain when doing GraalVM native image builds

Comment From: wilkinsona

@joshlong Did you have the spring-boot-docker-compose dependency in the developmentOnly configuration? If so, it shouldn't have been included in AOT processing or the native image build.

Comment From: joshlong

@joshlong Did you have the spring-boot-docker-compose dependency in the developmentOnly configuration? If so, it shouldn't have been included in AOT processing or the native image build.

Yah it's a mystery https://github.com/spring-tips/development-containers-with-docker-compose-and-testcontainers/blob/main/build.gradle

Comment From: wilkinsona

If so, it shouldn't have been included in AOT processing or the native image build.

This was true for a while, but it looks like I broke it in the changes for https://github.com/spring-projects/spring-boot/issues/32930.