1
2 org.springframework.boot
3 spring-boot-starter-parent
4 1.2.5.RELEASE
5
6
7
8
9 UTF-8
10 1.8
11
12
13
14
15 org.springframework.boot
16 spring-boot-starter-web
17
18
19
20
21
22
23 org.springframework.boot
24 spring-boot-maven-plugin
25
26
27
1 package demo.web.application;
2 import org.springframework.boot.SpringApplication;
3 import org.springframework.boot.autoconfigure.SpringBootApplication;
4 import org.springframework.context.annotation.ComponentScan;
5
6 @SpringBootApplication
7 @ComponentScan(basePackages={"demo.web.*"})
8 public class Application {
9 public static void main(String[] args) {
10 SpringApplication.run(Application.class, args);
11 }
12
13 }
1 package demo.web.controller;
2 import org.springframework.boot.autoconfigure.EnableAutoConfiguration;
3 import org.springframework.web.bind.annotation.PathVariable;
4 import org.springframework.web.bind.annotation.RequestMapping;
5 import org.springframework.web.bind.annotation.RestController;
6
7 @RestController
8 @EnableAutoConfiguration
9 public class HelloController {
10
11 @RequestMapping("/")
12 String home() {
13 System.out.println("ee");
14 return "Hello World!";
15 }
16
17 @RequestMapping("/hello/{myName}")
18 String index(@PathVariable String myName) {
19 return "Hello "+myName+"!!!";
20 }
21
22 }