一. Spring Boot 开发入门— helloworld web
1.在Idea上创建基于Spring Boot的web 项目,当客户端浏览器访问该web资源时,返回的网页显示 “helloword Spring Boot!这是一个用Spring Boot开发的网站。”
首先,创建一个project
点击Finish即可创建完成。
完成以后是这样一个界面,接着我们在src/main/java/comexample.demo文件下创建一个controller文件夹
package com.example.demo.controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
@RestController
public class testController {
@RequestMapping("/bad")
public String hello() {
return "Hello Spring Boot!";
}
}
运行以后显示一条
之后我们打开浏览器,输入http://127.0.0.1:8080/bad即可。
二. Spring Boot 开发入门— RESTful 接口的 Web服务
1、初步了解HTTP协议,掌握B/S之间的 请求Request、服务响应Response和get、put、post等主要概念和技术方法。
(1)、 http的特点
1、简单快速:客户向服务器请求服务时,只需传送请求方法和路径。请求方法常用的有GET、HEAD、POST。每种方