private void close(ConfigurableApplicationContext context) {
		if (context != null) {
			context.close();
			ApplicationContext parent = context.getParent();
			if (parent instanceof ConfigurableApplicationContext) {
				close((ConfigurableApplicationContext) parent);
			}
		}
	}
Single Node XD Runtime.

@author Dave Syer
@author David Turanski
@author Ilayaperumal Gopinathan
spring-xd-dirt/src/main/java/org/springframework/xd/dirt/server/singlenode/SingleNodeApplication.java