课后作业
任务:创建Spring Boot项目输出学生信息
(一)创建Spring Boot项目StudentInfo
(二)创建控制器StudentInfoController
package net.tjl.less01.contorller;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
@RestController
public class StudentInfoController {
@GetMapping("/student")
public String student() {
return "<h3>学号:19205051</h3>" +
"<h3>姓名:谭金兰</h3>" +
"<h3>性别:女</h3>" +
"<h3>年龄:21</h3>" +
"<h3>专业:软件技术</h3>" +
"<h3>电话:12345673222</h3>" +
"<h3>邮编:2381185377@qq.com</h3>" +
"<h3>爱好:听歌、打羽毛球</h3>";
}
}
(三)运行启动类StudentInfoApplication
(四)在浏览器里访问http://localhost:8080/student