一、SpringBoot之Hello World

1、创建一个新的maven工程

一、SpringBoot之Hello World

2、pom.xml里面添加Spring Boot依赖

<parent>
    <groupId>org.springframework.boot</groupId>
    <artifactId>spring-boot-starter-parent</artifactId>
    <version>1.5.9.RELEASE</version>
</parent>
<dependencies>
    <dependency>
        <groupId>org.springframework.boot</groupId>
        <artifactId>spring-boot-starter-web</artifactId>
    </dependency>
</dependencies>

3、添加主程序类,程序入口

@SpringBootApplication
public class HelloWorldMainApplication {

    public static void main(String[] args) {

        SpringApplication.run(HelloWorldMainApplication.class,args);
    }
}

4、编写测试Controller

@Controller
public class HelloController {

    @RequestMapping("/hello")
    @ResponseBody
    public String Hello(){
        return "HelloWorld";
    }
}

5、以普通方式或者debug方式启动Spring Boot项目

一、SpringBoot之Hello World

6、访问路径,得到相应

一、SpringBoot之Hello World

成功完成第一个SpringBoot项目。