2013-05-21 22:28:00 +08:00
|
|
|
package org.test
|
|
|
|
|
2013-11-05 14:35:23 +08:00
|
|
|
import static org.springframework.boot.groovy.GroovyTemplate.*;
|
2013-05-21 22:28:00 +08:00
|
|
|
|
|
|
|
@Component
|
|
|
|
class Example implements CommandLineRunner {
|
|
|
|
|
|
|
|
@Autowired
|
|
|
|
private MyService myService
|
|
|
|
|
2014-05-20 19:36:32 +08:00
|
|
|
@Override
|
2013-05-21 22:28:00 +08:00
|
|
|
void run(String... args) {
|
|
|
|
print template("test.txt", ["message":myService.sayWorld()])
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
@Service
|
|
|
|
class MyService {
|
|
|
|
|
|
|
|
String sayWorld() {
|
|
|
|
return "World"
|
|
|
|
}
|
|
|
|
}
|