@Override
	public void afterPropertiesSet() throws Exception {
		if (root.startsWith("hdfs:")) {
			boolean securityConfigProvided = false;
			String authMethod = "";
			String namenodePrincipal = "";
			String rmManagerPrincipal = "";
			String userPrincipal = "";
			String userKeytab = "";
			// try servers.yml first
			if (environment != null && environment.containsProperty("spring.hadoop.security.authMethod")) {
				securityConfigProvided = true;
				authMethod = environment.getProperty("spring.hadoop.security.authMethod");
				namenodePrincipal = environment.getProperty("spring.hadoop.security.namenodePrincipal");
				rmManagerPrincipal = environment.getProperty("spring.hadoop.security.rmManagerPrincipal");
				userPrincipal = environment.getProperty("spring.hadoop.security.userPrincipal");
				userKeytab = environment.getProperty("spring.hadoop.security.userKeytab");
			}
			// check hadoop.properties and load it as
			// Properties to get additional configs
			Properties hadoopProps = null;
			if (!securityConfigProvided && environment != null) {
				String xdConfigHadoopProps = environment.getProperty(XD_CONFIG_HOME) + "hadoop.properties";
				try {
					hadoopProps = PropertiesLoaderUtils.loadProperties(new UrlResource(xdConfigHadoopProps));
				}
				catch (IOException ignore) {
				}
				if (hadoopProps != null && (hadoopProps.containsKey("spring.hadoop.security.authMethod") ||
						hadoopProps.containsKey("hadoop.security.authentication"))) {
					securityConfigProvided = true;
					authMethod = hadoopProps.getProperty("spring.hadoop.security.authMethod");
					if (!StringUtils.hasText(authMethod)) {
						authMethod = hadoopProps.getProperty("hadoop.security.authentication");
					}
					namenodePrincipal = hadoopProps.getProperty("spring.hadoop.security.namenodePrincipal");
					if (!StringUtils.hasText(namenodePrincipal)) {
						namenodePrincipal = hadoopProps.getProperty("dfs.namenode.kerberos.principal");
					}
					rmManagerPrincipal = hadoopProps.getProperty("spring.hadoop.security.rmManagerPrincipal");
					if (!StringUtils.hasText(rmManagerPrincipal)) {
						rmManagerPrincipal = hadoopProps.getProperty("yarn.resourcemanager.principal");
					}
					userPrincipal = hadoopProps.getProperty("spring.hadoop.security.userPrincipal");
					userKeytab = hadoopProps.getProperty("spring.hadoop.security.userKeytab");
				}
			}

			// get 'spring.hadoop.config.' props from other
			// sources to support generic hadoop settings
			// via yml
			Properties factoryProps = new Properties();
			if (environment != null) {
				Iterator<PropertySource<?>> i = environment.getPropertySources().iterator();
				while (i.hasNext()) {
					PropertySource<?> p = i.next();
					if (p instanceof EnumerablePropertySource) {
						for (String name : ((EnumerablePropertySource) p).getPropertyNames()) {
							if (name.startsWith("spring.hadoop.config.")) {
								// remove 'spring.hadoop.config.' prefix
								factoryProps.put(name.substring(21), environment.getProperty(name));
							}
						}
					}
				}
			}

			ConfigurationFactoryBean configurationFactoryBean = new ConfigurationFactoryBean();
			configurationFactoryBean.setRegisterUrlHandler(true);
			configurationFactoryBean.setFileSystemUri(root);
			if (hadoopProps != null) {
				// hadoop.properties will override
				factoryProps.putAll(hadoopProps);
			}
			configurationFactoryBean.setProperties(factoryProps);
			if (securityConfigProvided && "kerberos".equals(authMethod)) {
				configurationFactoryBean.setSecurityMethod(authMethod);
				configurationFactoryBean.setNamenodePrincipal(namenodePrincipal);
				configurationFactoryBean.setRmManagerPrincipal(rmManagerPrincipal);
				configurationFactoryBean.setUserPrincipal(userPrincipal);
				configurationFactoryBean.setUserKeytab(userKeytab);
			}
			configurationFactoryBean.afterPropertiesSet();

			this.resolver = new HdfsResourceLoader(configurationFactoryBean.getObject());
		}

		if (createDirectoryStructure) {
			// Create intermediary folders
			for (ModuleType type : ModuleType.values()) {
				Resource folder = getResources(type.name(), "", "").iterator().next();
				if (!folder.exists()) {
					ExtendedResource.wrap(folder).mkdirs();
				}
			}
		}

	}
Whether to attempt to create the directory structure at startup (disable for read-only implementations).
spring-xd-dirt/src/main/java/org/springframework/xd/dirt/module/WritableResourceModuleRegistry.java