2013-05-21 22:28:00 +08:00
|
|
|
package org.test
|
|
|
|
|
|
2013-07-09 04:39:03 +08:00
|
|
|
import static org.springframework.cli.template.GroovyTemplate.template;
|
2013-05-21 22:28:00 +08:00
|
|
|
|
|
|
|
|
@Component
|
|
|
|
|
class Example implements CommandLineRunner {
|
|
|
|
|
|
|
|
|
|
@Autowired
|
|
|
|
|
private MyService myService
|
|
|
|
|
|
|
|
|
|
void run(String... args) {
|
|
|
|
|
print template("test.txt", ["message":myService.sayWorld()])
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
@Service
|
|
|
|
|
class MyService {
|
|
|
|
|
|
|
|
|
|
String sayWorld() {
|
|
|
|
|
return "World"
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|