Given the following code to register a BeanDefinition:

registry.registerBeanDefinition("my-bean-consumer", BeanDefinitionBuilder.rootBeanDefinition(BeanConsumer.class)
        .addConstructorArgValue(new RuntimeBeanReference(Bean.class))
        .getBeanDefinition());

then generating AOT code results in:

Class<?> beanType = BeanConsumer.class;
RootBeanDefinition beanDefinition = new RootBeanDefinition(beanType);
beanDefinition.getConstructorArgumentValues().addIndexedArgumentValue(0, new RuntimeBeanReference("com.example.demo.Bean"));
beanDefinition.setInstanceSupplier(InstanceSupplier.of(BeanConsumer__BeanDefinitions::getMybeanconsumerInstance));

The constructor reference value now points to a bean named com.example.demo.Bean instead of using the type reference com.example.demo.Bean. Running that code leads to:

BeanCreationException: Error creating bean with name 'my-bean-consumer': Cannot resolve reference to bean 'com.example.demo.Bean' while setting constructor argument

Additional code used to reproduce the issue:

public class Bean {
}

public class BeanConsumer {

    public BeanConsumer(Bean bean) {
    }
}

public class ReproducerRegistrar implements ImportBeanDefinitionRegistrar {

    @Override
    public void registerBeanDefinitions(AnnotationMetadata importingClassMetadata, BeanDefinitionRegistry registry, BeanNameGenerator importBeanNameGenerator) {

        registry.registerBeanDefinition("my-bean", BeanDefinitionBuilder.rootBeanDefinition(Bean.class)
                .getBeanDefinition());

        registry.registerBeanDefinition("my-bean-consumer", BeanDefinitionBuilder.rootBeanDefinition(BeanConsumer.class)
                .addConstructorArgValue(new RuntimeBeanReference(Bean.class))
                .getBeanDefinition());

    }
}