public static void injectMessageBus(SingleNodeApplication application, AbstractTestMessageBus<?> testMessageBus) {
		ConfigurableApplicationContext pluginContext = application.pluginContext();
		RootBeanDefinition beanDefinition = new RootBeanDefinition(StreamPlugin.class);
		ConstructorArgumentValues constructorArgumentValues = new ConstructorArgumentValues();
		constructorArgumentValues.addIndexedArgumentValue(0, testMessageBus);
		beanDefinition.setConstructorArgumentValues(constructorArgumentValues);
		BeanDefinitionRegistry registry = (BeanDefinitionRegistry) pluginContext.getBeanFactory();
		registry.removeBeanDefinition(STREAM_PLUGIN_BEAN_ID);
		registry.registerBeanDefinition(STREAM_PLUGIN_BEAN_ID, beanDefinition);
		ModuleDeployer moduleDeployer = application.containerContext().getBean(ModuleDeployer.class);
		moduleDeployer.afterPropertiesSet();
	}
Test class that helps injecting messageBus into {@link ModuleDeployer}'s common context via {@link TestStreamPlugin}.

@author Ilayaperumal Gopinathan
@author David Turanski
spring-xd-dirt/src/test/java/org/springframework/xd/dirt/config/TestMessageBusInjection.java