




查看pom.xml文件,刚才选择web,导入的依赖包


增加一个package,叫controller

在controller的package里面增加一个接口叫做HelloContrllor
代码:https://github.com/NIGHTFIGHTING/spring_boot_learning/tree/master/01
package com.liuqi.boot.liuqiboothelloworld.controller;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RestController;
@RestController
public class HelloController {
@GetMapping("/home")
public String Home() {
return "hello liuqi!\n";
}
}
#默认spring boot端口8080
curl http://127.0.0.1:8080/home

IDEA如何配置SpringBoot项目
https://jingyan.baidu.com/article/f0062228e64b7cbbd3f0c8cc.html
1375

被折叠的 条评论
为什么被折叠?



