2013-04-24 17:02:07 +08:00
|
|
|
package org.test
|
|
|
|
|
|
2013-04-24 23:09:17 +08:00
|
|
|
@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
|
2013-04-29 15:35:01 +08:00
|
|
|
private MyService myService
|
2013-04-24 17:02:07 +08:00
|
|
|
|
2013-04-29 15:35:01 +08:00
|
|
|
void run(String... args) {
|
2013-12-04 19:13:49 +08:00
|
|
|
println "Hello ${this.myService.sayWorld()} From ${getClass().getClassLoader().getResource('samples/app.groovy')}"
|
2013-04-24 17:02:07 +08:00
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
2013-04-24 23:09:17 +08:00
|
|
|
@Service
|
2013-04-24 17:02:07 +08:00
|
|
|
class MyService {
|
|
|
|
|
|
2013-04-29 15:35:01 +08:00
|
|
|
String sayWorld() {
|
|
|
|
|
return "World!"
|
2013-04-24 17:02:07 +08:00
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|