spring boot学习笔记一——快速入门

2018-09-19  本文已影响0人  维特or卡顿

一 创建项目

maven构建项目

IDEA直接创建

项目结构介绍

项目结构

如上图所示,Spring Boot的基础结构共三个文件:

 DemoApplication.java:应用程序的启动引导类(bootstrap class),也是主要
的Spring配置类。
 application.properties:用于配置应用程序和Spring Boot的属性。
 DemoApplicationTests.java:一个基本的集成测试类。

编写controller内容

@RestController
public class HelloController {
    @RequestMapping ("/hello")
    public String helloWorld(ModelMap map) {
        return "helloWorld";
}

启动

启动主程序,打开浏览器访问http://localhost:8080/hello,就可以看到效果了

next :spring boot学习笔记二——连接数据库

上一篇 下一篇

猜你喜欢

热点阅读