HTTP入门
SpringbootWebQuickstart是自动建好的启动类。
HelloController
import org.springframework.web.bind.annotation.RequestMapping; import org.springframework.web.bind.annotation.RestController; //请求处理类 @RestController public class HelloController { @RequestMapping("/hello") public String Hello(){ System.out.println("Hello"); return "Hello"; } }
效果:
Http协议
web服务器:Tomcat
Springboot内置了Tomcat,不用下载,详情参考
Spring Boot:内置tomcat启动和外部tomcat部署总结_spring boot tomcat-CSDN博客
请求响应
请求:
接口测试工具postman
1.新建workspace
2.