private ConfigurableApplicationContext initializeAndRun(Class<?> config, Map<String, Object> properties, String... args) { Restarter.initialize(new String[0], false, new MockRestartInitializer(), false); SpringApplication application = new SpringApplication(config); application.setDefaultProperties(getDefaultProperties(properties)); application.setWebEnvironment(false); ConfigurableApplicationContext context = application.run(args); return context; }