Exclude ApplicationStartup Event listener when testing
问题 I recently added an ApplicationStartup class to my SpringBoot project @Component public class ApplicationStartup implements ApplicationListener<ApplicationReadyEvent> { ... It implements ApplicationListener. Now when I run my old JUNit tests that have nothing to do with that class, The testrunner tries to Run my StartupListener, which is neither necessary not appropriate in these cases. How do I skip the ApplicationListener when my tests initialize? @RunWith(SpringRunner.class)