@Override
	public void onApplicationEvent(ApplicationPreparedEvent event) {
		ConfigurableApplicationContext context = event.getApplicationContext();

		PathMatchingResourcePatternResolver resourceResolver = new PathMatchingResourcePatternResolver(context);

		XmlBeanDefinitionReader xmlReader = new XmlBeanDefinitionReader(
				(BeanDefinitionRegistry) context.getBeanFactory());
		xmlReader.setEnvironment(context.getEnvironment());

		GroovyBeanDefinitionReader groovyReader = new GroovyBeanDefinitionReader(
				(BeanDefinitionRegistry) context.getBeanFactory());
		groovyReader.setEnvironment(context.getEnvironment());


		for (String locationPattern : getLocations()) {
			try {
				Resource[] resources = resourceResolver.getResources(locationPattern);
				logger.info("resolving resource location pattern {}", locationPattern);
				for (Resource resource : resources) {
					if (resource.getFilename() != null) {
						if (resource.getFilename().endsWith(".xml")) {
							logger.info("loading XD extensions from {}", resource.getFilename());
							xmlReader.loadBeanDefinitions(resource);
						}
						else if (resource.getFilename().endsWith(".groovy")) {
							groovyReader.loadBeanDefinitions(resource);
						}
					}
				}
			}
			catch (IOException e) {
				logger.warn("could not resolve resources for {}", locationPattern);
			}

		}
	}
A {@link OrderedContextInitializer} base class for loading XML or Groovy Bean Definitions into the target Container
Context.

@author David Turanski
spring-xd-dirt/src/main/java/org/springframework/xd/dirt/container/initializer/AbstractResourceBeanDefinitionProvider.java