spring-boot/spring-boot-cli/samples/template.groovy
Dave Syer 334c8142c4 Enhance Groovy template support in CLI
to allow user to specify the TemplateEngine

Fixes gh-908
2014-05-20 12:36:32 +01:00

25 lines
362 B
Groovy

package org.test
import static org.springframework.boot.groovy.GroovyTemplate.*;
@Component
class Example implements CommandLineRunner {
@Autowired
private MyService myService
@Override
void run(String... args) {
print template("test.txt", ["message":myService.sayWorld()])
}
}
@Service
class MyService {
String sayWorld() {
return "World"
}
}