mirror of
https://github.com/spring-projects/spring-boot.git
synced 2024-09-03 04:26:12 +08:00
24 lines
288 B
Groovy
24 lines
288 B
Groovy
package org.test
|
|
|
|
@Component
|
|
class Example implements CommandLineRunner {
|
|
|
|
@Autowired
|
|
private MyService myService;
|
|
|
|
public void run(String... args) {
|
|
print "Hello " + this.myService.sayWorld();
|
|
}
|
|
}
|
|
|
|
|
|
@Service
|
|
class MyService {
|
|
|
|
public String sayWorld() {
|
|
return "World!";
|
|
}
|
|
}
|
|
|
|
|