mirror of
https://github.com/spring-projects/spring-boot.git
synced 2024-09-03 04:26:12 +08:00
22 lines
257 B
Groovy
22 lines
257 B
Groovy
@Controller
|
|
class Example {
|
|
|
|
@Autowired
|
|
private MyService myService;
|
|
|
|
@RequestMapping("/")
|
|
@ResponseBody
|
|
public String helloWorld() {
|
|
return myService.sayWorld();
|
|
}
|
|
|
|
}
|
|
|
|
@Service
|
|
class MyService {
|
|
|
|
public String sayWorld() {
|
|
return "World!";
|
|
}
|
|
}
|