2013-05-21 22:28:00 +08:00
|
|
|
package org.test
|
|
|
|
|
2021-01-01 22:15:38 +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"
|
|
|
|
}
|
|
|
|
}
|