spring-boot/spring-boot-cli/samples/app.groovy

24 lines
271 B
Groovy
Raw Normal View History

2013-04-24 17:02:07 +08:00
package org.test
@Component
2013-04-25 17:17:47 +08:00
class Example implements CommandLineRunner {
2013-04-24 17:02:07 +08:00
2013-04-25 17:17:47 +08:00
@Autowired
private MyService myService
2013-04-24 17:02:07 +08:00
void run(String... args) {
print "Hello " + this.myService.sayWorld()
2013-04-24 17:02:07 +08:00
}
}
@Service
2013-04-24 17:02:07 +08:00
class MyService {
String sayWorld() {
return "World!"
2013-04-24 17:02:07 +08:00
}
}