How springboot customizes whether bean is automatically instantiated

Today, when I used springboot to build MQ, I found that my project did not rely on kafka, results at all. springboot automatically instantiated kafkaTemplate , resulting in initialization failure. When solving the problem, consider whether there is any way to customize the springboot instantiation list. To put it simply: the initialization list of bean is decided by the user, and the user can ignore the initialization of some bean

.
Mar.28,2021

exclude automatic configuration
@SpringBootApplication(exclude={KafkaAutoConfiguration.class})
Menu