@Override
	public void setApplicationContext(ApplicationContext context) {
		this.context = context;

		ApplicationContext global = null;
		try {
			// TODO: evaluate
			// The application context hierarchy is arranged as such:
			//
			//         Global Context
			//              ^
			//     Shared Server Context
			//              ^
			//        Plugin Context
			//              ^
			//       Container Context
			//
			// The global context is supposed to be the parent
			// context for deployed modules which means the
			// context should be obtained via
			// context.getParent().getParent().getParent().
			// However this is causing shell test failures;
			// in particular NoSuchBeanDefinitionExceptions
			// for aggregateCounterRepository, fieldValueCounterRepository,
			// counterRepository, etc. This should be further evaluated.
//			global = context.getParent().getParent().getParent();
			global = context.getParent().getParent();
		}
		catch (NullPointerException e) {
			logger.trace("Exception looking up global application context", e);
			// npe handled by assert below
		}

		Assert.notNull(global, "Global application context not found");
		this.globalContext = global;
	}
{@inheritDoc}

@param context the container application context
spring-xd-dirt/src/main/java/org/springframework/xd/dirt/module/ModuleDeployer.java