Skip to content

Instantly share code, notes, and snippets.

@ereshzealous
Created December 16, 2019 15:46
Show Gist options
  • Save ereshzealous/33635bd62746278f9476014f5266d711 to your computer and use it in GitHub Desktop.
Save ereshzealous/33635bd62746278f9476014f5266d711 to your computer and use it in GitHub Desktop.
package com.minikube.sample.rest.controller;
import com.fasterxml.jackson.databind.ObjectMapper;
import lombok.Getter;
import lombok.Setter;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.http.HttpStatus;
import org.springframework.http.ResponseEntity;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
/**
* @author Gorantla, Eresh
* @created 06-12-2018
*/
@RestController
@RequestMapping("/home")
public class HomeResource {
@Value("${test}")
String test = null;
@GetMapping("/data")
public ResponseEntity<ResponseData> getData() {
ResponseData responseData = new ResponseData();
responseData.setId(1);
responseData.setName("Eresh");
responseData.setPlace("Hyderabad");
responseData.setValue(test);
return new ResponseEntity<ResponseData>(responseData, HttpStatus.OK);
}
@Getter
@Setter
public class ResponseData {
private String name;
private Integer id;
private String place;
private String value;
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment