2013-04-24 17:02:07 +08:00
|
|
|
package org.test
|
|
|
|
|
2013-04-24 23:09:17 +08:00
|
|
|
@Component
|
2013-04-24 17:02:07 +08:00
|
|
|
class Example implements org.springframework.bootstrap.CommandLineRunner {
|
|
|
|
|
|
|
|
@org.springframework.beans.factory.annotation.Autowired
|
|
|
|
private MyService myService;
|
|
|
|
|
|
|
|
public void run(String... args) {
|
|
|
|
print "Hello " + this.myService.sayWorld();
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
2013-04-24 23:09:17 +08:00
|
|
|
@Service
|
2013-04-24 17:02:07 +08:00
|
|
|
class MyService {
|
|
|
|
|
|
|
|
public String sayWorld() {
|
|
|
|
return "World!";
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|