I have bean DSL as follows:
class BeansInitializer : ApplicationContextInitializer<GenericApplicationContext> {
override fun initialize(applicationContext: GenericApplicationContext) {
beans {
bean {
ref<Jackson2ObjectMapperBuilder>().build()
}
// ...
When in processAot
I get the following exception:
Exception in thread "main" java.lang.IllegalArgumentException:
Code generation is not supported for bean definitions declaring an instance supplier callback :
Root bean: class [com.fasterxml.jackson.databind.ObjectMapper]; 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)
Sadly and surprisingly, this functionality is not supported in Spring.
https://github.com/spring-projects/spring-framework/issues/29555