码迷,mamicode.com
首页 > 编程语言 > 详细

Spring Boot 学习笔记(二)

时间:2017-10-04 18:29:35      阅读:120      评论:0      收藏:0      [点我收藏+]

标签:笔记   ref   font   ack   com   tom   技术   span   round   

 新建Srping Boot 项目

技术分享

以下是项目结构

技术分享

由于Srping Boot内置Tomcat,所以不需要配置Tomcat就可以直接运行。

HelloWorldApplication是启动类,我们右击Run As 选择 Spring Boot app。

项目运行好之后

技术分享

 

在浏览器输入:http://localhost:8080/

技术分享

 看到这个页面项目就算启动好了。

然后新建一个HelloWorldController类

import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

@RestController
public class HelloWorldController {
@RequestMapping("/helloWorld")
public String say() {
return "HelloWorld";
}
}

然后我们重新启动HelloWorldApplication类

请求 http://localhost:8080/helloworld

技术分享

 

 

Spring Boot 学习笔记(二)

标签:笔记   ref   font   ack   com   tom   技术   span   round   

原文地址:http://www.cnblogs.com/fyys/p/7625931.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!