Java spring ResponseEntity

Java spring ResponseEntity
@GetMapping("/customHeader")
ResponseEntity<String> customHeader() {
    HttpHeaders headers = new HttpHeaders();
    headers.add("Custom-Header", "foo");
        
    return new ResponseEntity<>(
      "Custom header ", headers, HttpStatus.OK);
}
//Simple way
@GetMapping("/hello")
ResponseEntity<String> hello() {
    return ResponseEntity.ok("Hello World!");
}
Sour‮:ec‬www.lautturi.com
Created Time:2017-09-28 21:52:41  Author:lautturi