视频地址
https://www.imooc.com/video/16713
使用官方地址生成项目
https://start.spring.io/
生成工程截图
解压后打开就可以。
这里讲师使用的是STS,我用的是IDEA.
pom.xml中引入web
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-web</artifactId>
</dependency>
创建controller
package com.imooc.controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
@RestController
public class HelloController {
@RequestMapping("/hello")
public Object hello(){
return "hello springboot";
}
}
启动环境后访问网址效果如下: