As pointed out by @maciejwalkowiak in #32763, there are a number of @Bean methods in KafkaAutoConfiguration where the return type isn't as specific as it could be. For example, kafkaConsumerFactory always returns a DefaultKafkaConsumerFactory but its return type is only ConsumerFactory.
Comment From: philwebb
Closing in favor of PR #32770. Thanks @YuanHao97!