spring processAot在来自Kotlinbean DSL的bean定义上失败

zy1mlcev  于 2023-06-28  发布在  Spring
关注(0)|答案(1)|浏览(163)

我有bean DSL如下:

class BeansInitializer : ApplicationContextInitializer<GenericApplicationContext> {
    override fun initialize(applicationContext: GenericApplicationContext) {
        beans {
            bean {
                ref<Jackson2ObjectMapperBuilder>().build()
            }
            // ...

processAot中,我得到以下异常:

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)

相关问题