Created
December 19, 2019 13:25
-
-
Save ereshzealous/d054afc8d62b14a9f93c61e03d74d62a to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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