Skip to content

Instantly share code, notes, and snippets.

@ereshzealous
Created December 19, 2019 13:25
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save ereshzealous/d054afc8d62b14a9f93c61e03d74d62a to your computer and use it in GitHub Desktop.
Save ereshzealous/d054afc8d62b14a9f93c61e03d74d62a to your computer and use it in GitHub Desktop.
package com.eresh.spring.rest;
import org.springframework.beans.factory.annotation.Autowired;
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;
import org.springframework.web.client.RestTemplate;
/**
* Created By Gorantla, Eresh on 19/Dec/2019
**/
@RestController
@RequestMapping("/api")
public class SampleController {
@Autowired
RestTemplate restTemplate;
@GetMapping("/sample")
public ResponseEntity<Object> getData() {
String url = "http://minikube-sample:8080/home/data";
ResponseEntity<String> responseEntity = restTemplate.getForEntity(url, String.class);
return ResponseEntity.ok(responseEntity.getBody());
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment