package me.yundongis.linkblogservice.controller;
import org.springframework.http.HttpHeaders;
import org.springframework.http.HttpStatus;
import org.springframework.http.ResponseEntity;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RestController;
@RestController
public class HelloController {
@GetMapping("/hello")
public ResponseEntity<Object> hello(){
HttpHeaders httpHeaders = new HttpHeaders();
httpHeaders.add("Content-Length","11");
// 参数1:返回的包体 参数2:返回的 Headers 参数3:状态码
return new ResponseEntity<>("hello,worlds!",httpHeaders, HttpStatus.OK);
}
}
扩展内容
github
个人博客
网友评论