搭建SpringBoot+WebService

创建spring boot 项目:在IDEA中新建项目时选择Spring Initializr

[图文介绍:http://blog.csdn.net/xyc_csdn/article/details/67672198]

不同type,项目结构不一样,默认选择Maven Project。

使用@RestController注解:

添加引用:

import org.springframework.web.bind.annotation.RestController; 或者开启自动添加引用。

 没有数据库配置不要勾选mybatis。

添加Controller文件。注意:controller的代码必须和DemoApplication.Java位于同级目录或之下:

 

完成,点击运行:

 

posted @ 2017-07-18 19:13  GHai  阅读(9934)  评论(4编辑  收藏  举报