blob: b0401aaee3456e24c405ac4a0ed315279d3735e0 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
|
package hello;
import org.springframework.boot.*;
import org.springframework.boot.autoconfigure.*;
import org.springframework.stereotype.*;
import org.springframework.web.bind.annotation.*;
/**
*
* @Controller - Indicates that an annotated class is a "Controller" (e.g. a web controller). This annotation serves as a specialization of @Component.
* @EnableAutoConfiguration - This annotation tells Spring Boot to "guess" how you want to configure Spring, based on the jar dependencies that you have added.
*
* @RequestMapping - Map the url pattern to a method
* @ResponseBody - Annotation that indicates a method return value should be bound to the web response body.
*
*/
@Controller
@EnableAutoConfiguration
public class SampleController {
@RequestMapping("/")
@ResponseBody
String home() {
return "Hello World!";
}
public static void main(String[] args) throws Exception {
SpringApplication.run(SampleController.class, args);
}
}
|