public static Resource resourceBasedConfigurationFile(SimpleModuleDefinition moduleDefinition) {
		Resource xml = ModuleUtils.locateModuleResource(moduleDefinition, ".xml");
		Resource groovy = ModuleUtils.locateModuleResource(moduleDefinition, ".groovy");
		boolean xmlExists = xml != null;
		boolean groovyExists = groovy != null;
		if (xmlExists && groovyExists) {
			throw new IllegalStateException(String.format("Found both resources '%s' and '%s' for module %s", xml,
					groovy, moduleDefinition));
		}
		else if (xmlExists) {
			return xml;
		}
		else if (groovyExists) {
			return groovy;
		}
		else {
			return null;
		}

	}
Return the resource that can be used to configure a module, or null if no such resource exists.

@throws java.lang.IllegalStateException if both a .xml and .groovy file are present
spring-xd-module/src/main/java/org/springframework/xd/module/options/ModuleUtils.java