As revealed by #29555, we should throw a more tailored exception when a bean definition uses an instance supplier. If one is set, the container must honor it and there's no way for us to inspect it to generate the appropriate code.
Comment From: sdeleuze
While working on this, I found that the current behavior is that instance suppliers on bean definition where the bean class has a default constructor are just ignored. Boot is implicitly leveraging this behavior, see https://github.com/spring-projects/spring-boot/issues/33763 for more details.
Boot and other Spring portfolio projects should probably stop using instance supplier as a first step, and then we should throw an error during AOT processing (potentially in BeanDefinitionMethodGenerator
constructor).
Comment From: sdeleuze
Draft commit available at https://github.com/sdeleuze/spring-framework/tree/gh-29556.
Comment From: jhoeller
Reopening for the Boot test failures reported by @wilkinsona