@Override
	public void preProcessModule(Module module) {
		module.addListener(new ApplicationListener<ApplicationPreparedEvent>() {
			@Override
			public void onApplicationEvent(ApplicationPreparedEvent event) {
				ZooKeeperConnection bean = getApplicationContext().getBean(ZooKeeperConnection.class);
				ConfigurableListableBeanFactory moduleBeanFactory = event.getApplicationContext().getBeanFactory();
				moduleBeanFactory.registerSingleton(XD_ZOOKEEPER_CLIENT, bean.getClient());
			}
		});
	}
Supplies plugins with a reference to the Spring XD {@link ZooKeeperConnection}

@author Marius Bogoevici
spring-xd-dirt/src/main/java/org/springframework/xd/dirt/plugins/ZookeeperConnectionPlugin.java