Created
December 2, 2014 17:13
-
-
Save trisberg/9abf3977076771e96082 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
@Grab('org.springframework.data:spring-data-hadoop:2.1.0.BUILD-SNAPSHOT-hadoop24') | |
@Grab('org.springframework.data:spring-data-hadoop-boot:2.1.0.BUILD-SNAPSHOT-hadoop24') | |
import org.apache.hadoop.fs.FileStatus | |
import org.springframework.data.hadoop.fs.FsShell | |
import org.springframework.data.hadoop.config.annotation.EnableHadoop | |
import org.springframework.data.hadoop.config.annotation.SpringHadoopConfigurerAdapter | |
import org.springframework.data.hadoop.config.annotation.builders.HadoopConfigConfigurer | |
@EnableAutoConfiguration | |
public class App implements CommandLineRunner { | |
@Autowired FsShell fsShell | |
void run(String... args) { | |
println("Hello!") | |
for (FileStatus fs : fsShell.ls("/")) { | |
println("> ${fs.path.name}") | |
} | |
} | |
@Bean FsShell fsShell(org.apache.hadoop.conf.Configuration conf) { | |
return new FsShell(conf) | |
} | |
@Configuration | |
@EnableHadoop | |
static class Config extends SpringHadoopConfigurerAdapter { | |
} | |
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
spring.hadoop.fsUri=hdfs://localhost:8020 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment