Skip to content

Instantly share code, notes, and snippets.

@trisberg
Created December 2, 2014 17:13
Show Gist options
  • Save trisberg/9abf3977076771e96082 to your computer and use it in GitHub Desktop.
Save trisberg/9abf3977076771e96082 to your computer and use it in GitHub Desktop.
@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 {
}
}
spring.hadoop.fsUri=hdfs://localhost:8020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment